[plug] word splitting
Cameron Patrick
cameron at patrick.wattle.id.au
Wed Nov 17 18:33:00 WST 2004
Timothy White wrote:
> I remember this from my readings of man pages and will probably use it
> in some scripts now. But what happens if there are no .jpg files in the
> directory? It will still do one loop except with $img='*.jpg'
> Any ideas how to get rid of that?
If you're using bash, you can do `shopt -s nullglob` which will make *.jpg
expand to the empty set rather than to '*.jpg'.
If you do use bashisms like this in a script, please make the #! line
refer to /bin/bash rather than /bin/sh or it will break on machines
where /bin/sh is not bash.
Cameron.
More information about the plug
mailing list