[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: Wildcard renaming of files



csj@mindgate.net wrote:
>Martin Fluch wrote:
>> A little bit bash programming...
>> 
>> for $i in *.html ; do mv "$i" "${i:0:${#tmp}-1}" ; done
>> 
>> Yes, I know, that this is quite cryptic ... but unfortunately I'm to tired
>> to explain it ... I've need some sleep :-)
>> 
>> Nevertheless it should work. Try 'man bash' for more information, but it
>> is long...
>
>I couldn't get any of the scripts (Martin, Colin Watson) to work. The error
>message has me stumped.
>
>"script.txt: `$i': not a valid identifier"

Urgh. We're both fools :) Replace 'for $i in *.html' with 'for i in
*.html' in all the scripts; you typically set shell variables using just
the name, but add a dollar sign before the name to get the value of the
variable.

-- 
Colin Watson                                     [cjw44@flatline.org.uk]



Reply to: