Moving files

bscott at ntisys.com bscott at ntisys.com
Mon Jan 6 10:49:06 EST 2003


On 6 Jan 2003, at 10:22am, ken.lussier at zuken.com wrote:
> for i in `ls`
> do
> cp $i `ls $i | sed s/\ /_/g`
> done

  You need to quote your arguments so the shell parser doesn't split on
spaces.  And what's with the fetch for invoking ls?  :-)  Anyway, try this:

for i in *
do
cp "$i" $(echo "$i" | sed s/\ /_/g )
done

-- 
Ben Scott <bscott at ntisys.com>
| The opinions expressed in this message are those of the author and do not |
| necessarily represent the views or policy of any other person, entity or  |
| organization.  All information is provided without warranty of any kind.  |




More information about the gnhlug-discuss mailing list