I'm pretty new to the bash shell scripting game but have been catching on fairly well. I'm writing a script right now for the automated id3 data editing or mp3 files. I'm currently using the id3v2 command line program. These are mp3 files that are coming from a police scanner program I have recording. I'm wondering if there is a way to make a variable related to the number the file...you know I'm not sure how to word this. Sorry, been battling a headache for the last couple of days. I can explain it like this.So if I were in a directory of recordings I can easily get them listed in order because the time they were recorded is a part of the file name. So a general ls command would produce something likeFile_012030.mp3File_012040.mp3File_012045.mp3I would like to use a variable to assign the track number to each files id3 data. My first thought is to somehow use the number of how far down it is in the list of files in that directory. So the above example would be. File_012030.mp3 <- 01File_012040.mp3 <- 02File_012045.mp3 <- 03Is this something that would be possible? 
Create variable based on the order a file is in an alphabetical list of files
bash;shell script;variable
Just use a for loop and a counter:k=1; for file in *mp3; do        id3v2 --track $k $file        ((k++))     doneThat will iterate over all files and directories whose name ends in mp3, saving each as $file. Then, the $k variable is incrementing once per iteration (((k++))) so $k will be the number of the file in the order you process them and you can use --track $k to set the track number. 