Another useful tip I’m sure most people will be familiar with, but in bash scripts $#
stores the number of arguments passed to the script. Eg, combine with $@ (all arguments) for batch processing (what I used it for):
foreach $arg in $@; do
[stuff]
[compare with $# to tell remaining items]
done
Very basic stuff, but it was new to me yesterday, and it might save someone a bit of time searching.
Pingback: Bertie Baggio's Wonderland » Count Arguments In A Bash Script Scripts Rss