curly braces on the shell
Jun. 2nd, 2013 11:50 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
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
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