Say you want to move all the files in the current directory down into a new directory called “awesome”.
Instead of:
mkdir awesome
mv * awesome
which is likely to complain: “mv: rename awesome to awesome/awesome: Invalid argument” (though it does in fact work), you might try:
mkdir z
mv *
mv z awesome
This “works” when the newly created directory, called “z”, comes at the end of the list that “*” expands to. You weren’t in the habit of creating files beginning with z were you?
2007-07-17 at 12:06:54
That is twisted.
2007-07-17 at 12:24:43
In so many ways.
2007-07-17 at 13:10:57
I often do this:
mkdir _ ; mv * _ ; rm -rf _ &
…to reset a particular flavor of cache directory quickly. GNU mv at least moves everything but _ and prints a warning which I ignore.
2007-07-17 at 13:18:08
_? _!? That requires pressing Shift! Are you insane!
Nice trick I mean. I use the mv somewhere else and asyncronously rm it trick for directories containing build products sometimes.
2007-07-17 at 13:30:24
Mmm, yes, that one could be optimized a bit l-)
2007-07-17 at 14:44:52
If pressing shift slows you down, practise more. Besides, we’re already pressing shift a lot in shell: “!$&*()~|><
2007-07-17 at 14:47:25
In fact, sometimes I wonder if shell would be better written with shift lock on. But ;\’`
2007-07-23 at 19:10:22
Instead of z, you could create a directory called }
which puts it at the end of the sort order:
And how often have you seen or used } in a directory
or file name?
Ok, it does mean you have to press the shift key.
2007-07-23 at 22:03:41
You’re both barking mad.
2007-07-24 at 07:52:36
> mkdir }
Hahahahaha! We’re clearly both barking mad. I did actually spot that } was above z on the ascii(7) chart, but I thought “that’ll never work, because it must be a shell meta-character”. Naturally I didn’t try it. Shell lexical analysis will never fail to disturb me.