you need to use a $ to evaluate a variable e.g. for i in 1 2 3 4 5 do echo vol000$i done if you are using bash shell T On 28 Mar 2007, at 14:36, Mustafa Cavusoglu wrote: > I am trying to write a shell script to interpolate the ASL > data. my file names are vol0000.nii.gz, vol0001.nii.gz up > to vol0099.nii.gz > > I only want to average the even and odd files corrsponding > to tag and control images and cancel the first and the last > file and subtract from ecach other. How can use a variable > in the file name in order to create a loop to do theis such > as > > i=1 > vol000i > > thanks