<p dir="ltr">Maybe whoever said that was thinking about the difficulty of writing stable code that relies on "ls -l" output? In that case you would be better off with stat(2) or /bin/test, probably. </p>
<div class="gmail_quote">On Aug 26, 2015 6:24 PM, "DJ-Pfulio" <<a href="mailto:DJPfulio@jdpfu.com">DJPfulio@jdpfu.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I seem to recall being told to NEVER parse the output from ls - ever.<br>
Maybe I misunderstood?<br>
<br>
On 08/26/2015 05:38 PM, Jim Kinney wrote:<br>
> Yeah. What he said.<br>
> From my F22 bash-land (4.3.39):<br>
> touch a.pdf A.pdf b.pdf B.pdf c.pdf C.pdf z.pdf Z.pdf<br>
> [jkinney@dhcp061167 tmp]$ ls<br>
> a.pdf A.pdf b.pdf B.pdf c.pdf C.pdf z.pdf Z.pdf<br>
> [jkinney@dhcp061167 tmp]$ ls | grep "[A-Z].pdf"<br>
> A.pdf<br>
> B.pdf<br>
> C.pdf<br>
> Z.pdf<br>
> [jkinney@dhcp061167 tmp]$ ls | grep "[a-z].pdf"<br>
> a.pdf<br>
> b.pdf<br>
> c.pdf<br>
> z.pdf<br>
> On Wed, 2015-08-26 at 15:41 -0400, Ed Cashin wrote:<br>
>> I've been biting my tongue here. I don't think these characteristics<br>
>> of bash are congruent with UNIX philosophy. The people who made UNIX<br>
>> complain about bash being bloated. These characteristics of bash are<br>
>> congruent with POSIX philosophy.<br>
>><br>
>> A UNIX-ish way of doing this would be ...<br>
>><br>
>> ls | grep '^[A-Z].*\.pdf'<br>
>><br>
>><br>
>> On Wed, Aug 26, 2015 at 1:41 PM, Jim Kinney <<a href="mailto:jim.kinney@gmail.com">jim.kinney@gmail.com</a>><br>
>> wrote:<br>
>>> Wow! Shopt has enough options to make it stand next to emacs.<br>
>>> I don't understand why the default is essentially case insensitive<br>
>>> when everything else in bash is case sensitive. It looks like the<br>
>>> LANG makes it work that way but that makes no sense either to me. A<br>
>>> != a in standard US English.<br>
>>> More of the secret mysteries of Unix philosophy I've never wrapped<br>
>>> my head around.<br>
>>> On Aug 26, 2015 12:16 PM, "Scott Plante" <<a href="mailto:splante@insightsys.com">splante@insightsys.com</a>><br>
>>> wrote:<br>
>>>> I didn't know the globasciiranges option.<br>
>>>><br>
>>>> Another solution is the LC_COLLATE variable:<br>
_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" rel="noreferrer" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" rel="noreferrer" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
</blockquote></div>