[clug] Help with bash script

Brett Worth brett at worth.id.au
Sat Nov 1 09:55:15 GMT 2008


Alastair D'Silva wrote:
>> Well one thing to do as a start is this: (to take care of spaces).
>>
>>   mv "${file}" ${i}
> 
> Not quite everything you need . . . the for loop will still get tripped up
> on spaces. Shell expansion will expand the wildcard into a space separated
> list of files, which for will then split on spaces.

Not my bash:

[dart] touch a
[dart] touch "b b"
[dart] touch "c c c"
[dart] for F in *
> do
> ls -l "$F"
> done
-rw-r--r-- 1 brettw users 0 2008-11-01 20:52 a
-rw-r--r-- 1 brettw users 0 2008-11-01 20:52 b b
-rw-r--r-- 1 brettw users 0 2008-11-01 20:53 c c c

Brett


More information about the linux mailing list