On 4 May 2017 at 10:38, Tim Connors via luv-main <[email protected]> wrote:
> On Tue, 2 May 2017, Andrew McGlashan wrote:
>
>> # The ./ with the ls is there on purpose to make it safer
>> # from potential globbing issues
>> for old_fn in $(ls ./*.jpg)
>
> Just stop it right now!  Stop doing that!
>
> Just don't!
>
> `for old_fn in *.jpg` is all you need, all you want.  Then make sure
> "$old_fn" is properly quoted elsewhere.
>
> http://porkmail.org/era/unix/award.html

Yep, good advice.

For more information, see this wonderful and comprehensive
documentation:

http://mywiki.wooledge.org/BashPitfalls#for_i_in_.24.28ls_.2A.mp3.29

(
in case that link does not work, it is to Pitfall #1 at
http://mywiki.wooledge.org/BashPitfalls
)
_______________________________________________
luv-main mailing list
[email protected]
https://lists.luv.asn.au/cgi-bin/mailman/listinfo/luv-main

Reply via email to