Rename files with loop variable name

Rename files with loop variable name

I am trying to download a bunch of files and rename them as I go. the download portion works correctly, but i can't get it to rename the files. This is the script I'm using:

I am trying to download a bunch of files and rename them as I go. the download portion works correctly, but i can't get it to rename the files. This is the script I'm using:

COUNTER=0
for (( i = 696; i <= 773; i++ ))
  do
  fastq-dump --split-3 --accession SRR546$i
mv SRR546"$i"_1 ./"$COUNTER"mVD_SRR546$i_1
mv SRR546"$i"_2 ./"$COUNTER"mVD_SRR546$i_2
gzip *.fastq

COUNTER=$[COUNTER + 1] done

This will correctly download the file SRR546696, SRR546697 etc. but does nothing to rename them.

I also tried using:

rename 's/SRR/"$COUNTER"mVD_SRR/' *.fastq

but this also did nothing.

bash loops

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Bash until Loop and Bash until Loop Example

This tutorial explains the basics of the until loop in Bash. The until loop is used to execute a given set of commands as long as the given condition evaluates to false.

Bash For Loop,The Standard Bash for Loop

In this tutorial, we will cover the basics of for loops in Bash. We will also show you how to use the break and continue statements to alter the flow of a loop.

Bash while Loop and Infinite while Loop

Loops are one of the fundamental concepts of programming languages. This tutorial covers the basics of while loops in Bash.

How to Use If-Else Statements and Loops in R – Dataquest

Learn to use if-else statements, for loops, and while loops to build complex conditional programs in R, a valuable skill for aspiring data scientists.

For loop in C++ Program | C++ For Loop Example

For loop in C++ Program | C++ For Loop Example.