[arch-general] BASH no longer does 'for i in $(ls); do ls $i; done'??
David C. Rankin
drankinatty at suddenlinkmail.com
Wed May 19 02:26:35 EDT 2010
On 05/18/2010 03:47 PM, Sergey Manucharian wrote:
> Excerpts from Linas's message of Tue, 18 May 2010 22:31 +0200:
>
>> David C. Rankin wrote:
>>> Guys,
>>>
>>> I'm usually quite good at one-liners, but my simple ones no
>>> longer work in Arch. Same cli works fine in suse. What have I
>>> messed up? To wit:
>>>
>>>
>>> What could keep the simple cli from working on Arch? I know
>>> this stuff worked before updates this morning... What should I look
>>> at?
>> Bash was updated from 4.1.5(2) to 4.1.7(2).
>> I can't reproduce it, though.
>
> I cannot reproduce it either and suspect that your "ls" under $() is
> not the real ls, but an alias. I've played with some, and they indeed
> produce bad output.
>
> Cheers,
> Sergey
>
Ahah! I bet you are right. I have aliased ls as:
alias ls='ls --color --group-directories-first'
which is the way I like ls to work. Let's do a test:
[01:19 nirvana:/home/david] # mv /etc/bash.bashrc.local /etc/bash.bashrc.local.sav
[01:19 nirvana:/home/david] # x
exit
01:19 nirvana:~> su
[01:20 nirvana:/home/backup/rpms/compiz_X11.0] # for i in $(ls); do echo "dir:
$i"; done
dir: i586
dir: noarch
dir: repodata
dir: repoview
dir: src
dir: x86_64
now dropping back to my user shell where the alias is still applied:
01:21 nirvana:/home/backup/rpms/compiz_X11.0> for i in $(ls); do echo "dir: $i";
done
dir: i586
dir: noarch
dir: repodata
dir: repoview
dir: src
dir: x86_64
Double Huh??? Now it works?? I haven't altered the environment for this shell
yet?? Let's use my original command line:
01:22 nirvana:/home/backup/rpms/compiz_X11.0> for i in $(ls); do ls ${i}; done
ls: cannot access i586: No such file or directory
ls: cannot access noarch: No such file or directory
ls: cannot access repodata: No such file or directory
ls: cannot access repoview: No such file or directory
ls: cannot access src: No such file or directory
ls: cannot access x86_64: No such file or directory
Ah hah! I knew I was screwing myself, I just didn't know how. Let's find out:
01:23 nirvana:/home/backup/rpms/compiz_X11.0> for i in $(ls); do echo "'$i'"; done
'i586'
'noarch'
'repodata'
'repoview'
'src'
'x86_64'
01:24 nirvana:/home/backup/rpms/compiz_X11.0> for i in $(ls); do echo "'ls
${i}'"; done
'ls i586'
'ls noarch'
'ls repodata'
'ls repoview'
'ls src'
'ls x86_64'
01:25 nirvana:/home/backup/rpms/compiz_X11.0> for i in $(ls); do echo "'ls
${i}'"; ls $i; done
'ls i586'
ls: cannot access i586: No such file or directory
'ls noarch'
ls: cannot access noarch: No such file or directory
'ls repodata'
ls: cannot access repodata: No such file or directory
'ls repoview'
ls: cannot access repoview: No such file or directory
'ls src'
ls: cannot access src: No such file or directory
'ls x86_64'
ls: cannot access x86_64: No such file or directory
... I give up :-( ...
--
David C. Rankin, J.D.,P.E.
Rankin Law Firm, PLLC
510 Ochiltree Street
Nacogdoches, Texas 75961
Telephone: (936) 715-9333
Facsimile: (936) 715-9339
www.rankinlawfirm.com
More information about the arch-general
mailing list