Categories: links, linux, programming, python, snark, solaris, spam, sysadmin, tech, unix, web.
|
2009-01-09 A Unix shell glob trickThis is the kind of trick where first I show the trick and then I explain it: $ touch a-b; mkdir a-c $ cd a-* sh: cd: a-b: Not a directory $ cd a-*/ $ pwd /tmp/a-c (This is also a good illustration of quality of implementation in error
handling. A number of non-bash Bourne shells will report things like
' What this does is use a trick to pick the directory out of an otherwise
ambiguous wildcard expansion. When there's a (The usual case for me is that I have just unpacked Reading very carefully between the lines, I think that this behavior is
required by the SUS. In general
a shell might as well support this, since you can always write the
wildcard as ' A closely related trick can be used to find all of the subdirectories
in your current directory (or in general, somewhere): ' (Ironically, bash gets this one right, and I believe that getting it right is the SUS-required behavior.)
|
These are my WanderingThoughts GettingAround This is part of CSpace, and is written by ChrisSiebenmann. * * * Atom feeds are available; see the bottom of most pages. Categories: links, linux, programming, python, snark, solaris, spam, sysadmin, tech, unix, web |