How to un-select files in shell wildcard patterns

John Levine johnl at iecc.com
Sat Jun 22 02:19:58 UTC 2019


>This is exactly what I an trying to avoid, i. e., not depend on
>external programs, but instead use what the shell offers interally.

>So, is it correct that there is no shell builtin mechanism for
>this kind of "negative selection"?

You can fake it.  Undebugged code follows:

 for i in *
 do case "$i" in
   *.tex) ;;
   *) echo "not a tex file: $i" ;;
  esac
 done

 for i in *
 do case "$i" in
   *a*) ;;
   *) echo "no a's here: $i" ;;
  esac
 done



More information about the freebsd-questions mailing list