I want to excluse a specific filename (say, fubar.log) from a shell (bash) globbing string, *.log. Nothing of what I tried seems to work, because g
fubar.log
*.log
if you are using bash
#!/bin/bash shopt -s extglob ls !(fubar).log
or without extglob
extglob
shopt -u extglob for file in !(fubar).log do echo "$file" done
or
for file in *log do case "$file" in fubar* ) continue;; * ) echo "do your stuff with $file";; esac done