I want to use my script on many files sometimes.
I used this for the purpose:
for etminput in $1 do #process done
But this just gives the first input. How can I do the process on every wildcard matches?
If you want to loop over all the arguments to your script, in any Bourne like shell, it's:
You could also do:
but it's longer and not as portable (though is for modern shells).
is neither Bourne nor POSIX so should be avoided (though it works in many shells)
For completeness, in non-Bourne shells:
You cannot use:
because that skips empty arguments
(es is rc on steroids).
Though it will accept the Bourne syntax, it also supports shorter ones like:
#!/bin/bash n=1 echo "$0 got $# args..." while [ $# -gt 0 ] ;do echo "$n: $1" shift n=$(( $n + 1 )) done
Alternatively, look up 'Listing arguments with $* and $@'