I want to perform a task on all the files in the current directory but I'd like to loop through them one at a time. How do I tell it to give me the first filename?
What is the criteria for the file to be the first one?.
If the criteria is change time or access time or modification time, then find or ls could be used.
Thanks
Nagarajan Ganesan
for file in *
do
# do something with "$file" here, e.g.:
n=$(( ${n:-0} + 1 ))
printf "%5d: %s\n" "$n" "$file"
done