aldez 1496579528 learn Version of exists that does not require setting/resetting of nullglob, but requires quoted pattern with proper escapes: exists() (shopt -s nullglob; files=($1); [[ -e ${files[0]} ]]); if exists '*.txt'; then echo yes, txt files; else echo no txt files; fi; if exists '.*rc'; then echo 'yes, .*rc is here (probably .bashrc)'; fi aldez 1496579808 forget aldez 1496580603 learn Version of exists that does not require setting/resetting of nullglob, but requires quoted pattern with inner escapes: exists() (shopt -s nullglob; IFS=; set -- $1; [[ -e $1 ]]); touch 'hell* there.txt'; if exists 'hell\* *.txt'; then echo yes; fi