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
[compare with $# to tell remaining items]
Very basic stuff, but it was new to me yesterday, and it might save someone a bit of time searching.