Fran Varas Blog

The history of an incredibly curious guy

Bash inverse wildcards

(entry from old blog) bash inverse wildcards Posted on March 22, 2014 by admin

If you want to ls all BUT the .sh files:

ls !(*.sh)

System Message: WARNING/2 (<string>, line 8); backlink

Inline emphasis start-string without end-string.

Example:

tatico@tortuguita:~/codigo/python/files_keeper/random_files$ ls .sh random_file-clean.sh random_file_generator.sh random_file_spread.sh tatico@tortuguita:~/codigo/python/files_keeper/random_files$ ls !(.sh) file4ShdNk filea6uHLm fileB4sRgx filecdQQzj fileLYvbHv fileo4TKHj fileoKaCVj fileSxbv0v fileTlphlz fileYLJ43w tatico@tortuguita:~/codigo/python/files_keeper/random_files$ ls file4ShdNk fileB4sRgx fileLYvbHv fileoKaCVj fileTlphlz random_file-clean.sh random_file_spread.sh filea6uHLm filecdQQzj fileo4TKHj fileSxbv0v fileYLJ43w random_file_generator.sh