[colug-432] Gracefully Doing Nothing

Rob Stampfli rob944 at cboh.org
Mon Jan 30 13:56:26 EST 2017


Before the advent of nullglob, this is how I typically approached this problem:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#!/bin/sh
j="[a-z]*"
for i in $j
do
case "$i" in
"$j" )  echo "Ignore $i" ;;		## or just leave this case entry null
*)      echo "Do not ignore $i" ;;
esac
done
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Works in all shells in normal use today.
Fails if there is an actual file present that is named "[a-z]*".

Rob


More information about the colug-432 mailing list