I would like to list all files matching a certain pattern while ignoring the case.
For example, I run the following commands:
ls *abc*
I want to see all the files that have "abc" as a part of the file name, ignoring the case, like
-rw-r--r-- 1 mtk mtk 0 Sep 21 08:12 file1abc.txt
-rw-r--r-- 1 mtk mtk 0 Sep 21 08:12 file2ABC.txt
Note
I have searched the man page for case, but couldn't find anything.
shport -s nocaseglob
? – mtk Sep 21 '12 at 17:11shopt -s
; to unset it, you useshopt -u
. Alternatively, you can wrap everything in a subshell by using( )
so that the setting doesn't affect the parent shell:(shopt -s nocaseglob ; ls *abc*)
. – ruakh Sep 21 '12 at 19:19[aA][bB][cC]
)? – Timothy Gu Nov 21 '14 at 16:01shopt
command in the last 15 yrs of using bash! – Reza Sanaie May 28 '15 at 19:12