:: Re: [DNG] Fearsome rumblings from G…
Page principale
Supprimer ce message
Répondre à ce message
Auteur: Brian Nash
Date:  
À: dng
Sujet: Re: [DNG] Fearsome rumblings from GNU
Personally, I only need to use `for f in /dir/*`.

Failing that, `echo /dir/*` (possibly piped through xargs) works too.

`ls` seems to be more for human eyes than scripting anyway.
All the modes, etc. should really be read through `stat`.

But when you're just starting out, you probably don't know that, hence
the use of `ls` in scripts. Once people do learn, they usually go back
and fix it. It's just part of the "larval stage" of hacking.

On Mon, Aug 08, 2016 at 10:23:54AM +0300, Jack L. Frost wrote:
>On Sun, Aug 07, 2016 at 01:22:25PM -0400, Brian Nash wrote:
>> I'm not sure on the specifics of the change, but for most scripted uses
>> you would probably pass it the `-1` flag anyway.
>>
>> If it doesn't list one file per line anymore, that could be quite
>> serious: we would need to use `dir` instead of `ls`!
>> That's a whole extra keystroke!
>>
>> If the changes turn out to be serious, you might want to try
>> suckless.org's version. (I believe it is called "sutils" and "putils", I
>> can confirm that they work.)
>
>No. The way you use ls in scripts is you don't.
>http://mywiki.wooledge.org/ParsingLs


--
Only a fool expects rational behavior from his fellow humans.