I am passing random number of files to a shell script and trying to print it using a for loop. I tried something as below.
cat >> script.csh
for (( i=1; i<=$#; i++ ));
do
echo $i
done
so if I do ./script.csh xyz.txt abc.txt pqr.txt
I am expecting the output to be
xyz.txt
abc.txt
pqr.txt
But I am getting the output as
1
2
3
Any help is much appreciated. Thanks
You can iterate through program arguments with this syntax: