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

Re: Accented chars in filenames issue



On 25/06/11 08:05, David Jardine wrote:
>    $ mkdir newdir; cd newdir
>    $ touch 'one space' 'and two spaces'
>    $ for jim in *; do echo $jim; done
>    and two spaces
>    one space
> 
> So far, so good, but:
> 
>    $ for jim in `ls`; do echo $jim; done
>    and
>    two
>    spaces
>    one
>    space

I don't understand why you'd use that method. If you do need to use that
approach "$jim" might be better (for other uses).

Try:-
$ ls -Q
"and two spaces"  "one space"

Or if the long route is required :-
$ ls -1Q | while read jim; do echo "$jim" ; done
"and two spaces"
"one space"



Cheers

-- 
I'm tired of this back-slapping "Isn't humanity neat?" bullsh#t. We're a
virus with shoes, okay? That's all we are.
~ Bill Hicks


Reply to: