jadelennox: Demonic Tutor, Jadelennox: my Magic card (demonic tutor)
jadelennox ([personal profile] jadelennox) wrote in [community profile] command_liners2013-06-02 11:50 pm

curly braces on the shell

So a fun shell trick (works in bash, tcsh, zsh) involves curly brace expansion. Different shells have different complexities, but the simplest case that works in all shells is

mv movies-19{92,93}.txt

which expands

mv movies-1992.txt movies-1993.txt

I use this daily. Usually to say mv foo.sh{,.bak} which translates to mv foo.sh foo.sh.bak
pauamma: Cartooney crab wearing hot pink and acid green facemask holding drink with straw (Default)

[personal profile] pauamma 2013-06-07 04:22 pm (UTC)(link)
ISTR first finding out about this on whatever *csh ran on SunOS 3 and SunOS 4. (IIRC, straight 4.xBSD csh)