jadelennox: Demonic Tutor, Jadelennox: my Magic card (demonic tutor)
[personal profile] jadelennox posting in [community profile] command_liners
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

Date: 2013-06-03 03:58 pm (UTC)
troisroyaumes: Painting of a duck, with the hanzi for "summer" in the top left (Default)
From: [personal profile] troisroyaumes
Wow, why didn't I know this before? Thank you, that is such a timesaver.

Date: 2013-06-05 12:42 pm (UTC)
cxcvi: Red cubes, sitting on a reflective surface, with a white background (Default)
From: [personal profile] cxcvi
I know I've used that syntax before, but the usage in the last line is new to me. That's actually really clever.

Date: 2013-06-05 03:43 pm (UTC)
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
From: [personal profile] afuna
I love this and ilu.

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

Date: 2013-06-07 08:23 pm (UTC)
brownbetty: (Default)
From: [personal profile] brownbetty
I used this on a rather complicated rsync recipe the other day and felt very clever.


command_liners: A command line prompt with a blinking cursor after it, green against black. (Default)
Command Liners

September 2014

1415 1617181920

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 20th, 2017 10:04 pm
Powered by Dreamwidth Studios