[clug] Help with bash script
Alastair D'Silva
alastair at newmillennium.net.au
Sat Nov 1 10:02:48 GMT 2008
You're right - also verified on /bin/sh on Solaris.
I was getting mixed up with the `ls` scenario, which does behave that way.
My bad :)
--
Alastair D'Silva mob: 0423 762 819
Networking Consultant
New Millennium Networking web: http://www.newmillennium.net.au
skype: alastair_dsilva msn: alastair at d-silva.org
blog: http://alastair.d-silva.org
-----Original Message-----
From: [mailto:brett.worth at gmail.com] On Behalf Of Brett Worth
Sent: Saturday, 1 November 2008 8:55 PM
To: Alastair D'Silva
Cc: 'CLUG List'
Subject: Re: [clug] Help with bash script
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