I would like to do what is mentioned in How to match case insensitive patterns with ls?
except for ksh. Is it possible to do it without any pain(regex)?
I would like to do what is mentioned in How to match case insensitive patterns with ls?
except for ksh. Is it possible to do it without any pain(regex)?
There are 3 main implementations of ksh
ksh
), with two main branches: ksh88
and ksh93
(and for ksh93
, many version with new features added for each).pdksh
, the public domain version (a free reimplementation of ksh88
with which it is mostly compatible) which is the base upon which is built the sh
on some BSDs like MirOS or OpenBSD (hence mksh
and oksh
).zsh
implementation. When called as ksh
, zsh
emulates the behavior of ksh88
with many of the features of ksh93
as well (and a few differences as well).With ksh93
:
print -r -- *.~(i:txt)
or
print -r -- ~(i)*.txt
With ksh88
or pdksh
and its derivatives such as mksh
:
print -r -- *.[tT][xX][tT]
With zsh's implementation of ksh
:
setopt nocaseglob
print -r -- *.txt
or
setopt extended_glob
print -r -- (#i)*.txt
With out regex, no!
But parsing 'ls' output with grep shouldn't be as much pain (if at all).
ls | grep -i '*xxx*'
ls
is almost always a bad idea. http://mywiki.wooledge.org/ParsingLs
– Mat
Jan 12 '14 at 11:39