May 2007
Beginner
628 pages
15h 46m
English
Warning—bash will alphabetize the data in a pattern match:
$ echo x.[ba] x.a x.b $
Even though you specified b then
a in the square brackets, when the
pattern matching is done and the results found, they will be alphabetized
before being given to the command to execute. That means that you don’t
want to do this:
$ mv x.[ba] $
thinking that it will expand to:
$ mv x.b x.a
Rather, it will expand to:
$ mv x.a x.b
since it alpha-sorts them before putting them in the command line, which is exactly the opposite of what you intended!
Read now
Unlock full access