[Tech] Sostituire gli spazi bianchi con underscore

Marco Ermini markoer@markoer.org
Gio 1 Lug 2004 11:01:02 CEST


<quota chi="Mattia Brunetti">
> Il 17:59, martedì 29 giugno 2004, paolo palmerini ha scritto:
>> #!/bin/bash
>>
>> for old in *.*; do
>>         new=`echo $old|tr ' ' '_'`
>>         mv $old $new
>> done
>
> Non funge perche' $old e' a b c.txt
> invece dovrebbe essere a\ b\ c.txt
>
> infatti 'mv a b c.txt a_b_c.txt' restituisce
> mv: quando vengono spostati più file l'ultimo argomento deve essere una
> directory
>
> Non ti preoccupare se trovo la soluzione, la posto ;)
</quota>

new=`echo "${old}"|tr ' ' '_'`


Ciao
-- 
Marco Ermini
http://www.markoer.org
Dubium sapientiae initium. (Descartes)
<< This message is for the designated recipient only and may contain
privileged or confidential information. If you have received it in
error, please notify the sender immediately and delete the original.
Any other use of the email by you is prohibited. >>



Maggiori informazioni sulla lista flug-tech