[wplug] Bash amazes me...

Christopher DeMarco cmd at alephant.net
Sun Feb 25 13:51:53 EST 2007


Ok, I've gotta share this with somebody:

Bash has a feature called 'brace expansion' which lets you say

    ls file{a,b,c}

and bash will expand this to "ls filea fileb filec".  Pretty useful.
But what blew my mind just now is that you can say

    ls fileESC{   # i.e. press the ESC key and then type a ``{''

and bash will automagically complete the brace expansion with all
possible matches in $PWD.

    (FYI, on most terminals ``ESC'' can also be typed as ctrl-{ (a
    handy hint for vi users), which is how I discovered this.)

Go ahead and try it; you'll be amazed.  It's even recursive; try it in
``/etc''...

I am officially impressed.


-- 
Christopher DeMarco <cmd at alephant.net>
Alephant Systems (http://alephant.net)
PGP public key at http://pgp.alephant.net
+1-412-708-9660


More information about the wplug mailing list