curly braces on the shell
Jun. 2nd, 2013 11:50 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
![[community profile]](https://www.dreamwidth.org/img/silk/identity/community.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
no subject
Date: 2013-06-03 03:58 pm (UTC)no subject
Date: 2013-06-05 12:42 pm (UTC)no subject
Date: 2013-06-05 03:43 pm (UTC)no subject
Date: 2013-06-07 04:22 pm (UTC)no subject
Date: 2013-06-07 08:23 pm (UTC)no subject
Date: 2017-12-02 11:32 pm (UTC){foo,bar}{.tex,.pdf}
becomes
foo.tex foo.pdf bar.tex bar.pfd