[LINK] literacy (not computer literacy) and GUIs

Craig Sanders cas@taz.net.au
Fri, 16 Nov 2001 08:29:57 +1100


On Thu, Nov 15, 2001 at 10:17:53AM -0700, Alastair Rankine wrote:
> James Polley wrote:
> >Rename *.bat *.bak
> >
> >Try *that* in a gui.
> 
> An interesting exercise. Let's try it using bash.
> [...]
>    ls *.bat | sed -e "s/[\\\"$]/\\\&/g" -e "s/\(.*\)\.bat$/mv 
> \"\1.bat\" \"\1.bak\"/" | sh

try:

mmv '*.bat' '#1.bak'

note, that's the 'mmv' command, not 'mv'.  see man page for details.

there are other easy ways of doing it if you don't have mmv installed.
hint: see the man page for 'basename'.


> I'm constantly amazed at how poorly common CLI tools perform at their 
> bread-and-butter tasks like this one.

it's a poor craftsman who blames his tools.


craig

-- 
craig sanders <cas@taz.net.au>

Fabricati Diem, PVNC.
 -- motto of the Ankh-Morpork City Watch