Tiny Core Base > TCB Tips & Tricks

Quick tricks, calendar, dirty image viewer

<< < (2/3) > >>

jpeters:

--- Quote from: ^thehatsrule^ on March 02, 2009, 12:01:00 AM ---If you are worried about that, you could use something like this instead:

--- Code: ---for x in `ls -1 /opt/.backgrounds/ | grep -i  "\.\(gif\|png\|bmp\|jpg\|jpeg\)" `
--- End code ---


--- End quote ---

needs a "*" (edit: don't think "-l" is necessary :) )

--- Code: ---for x in `ls  /opt/.backgrounds/* | grep -i  "\.\(gif\|png\|bmp\|jpg\|jpeg\)" `
--- End code ---

MakodFilu:
I think I should open the regex book I have and start reading it once and for all (: (or twice, or...)

^thehatsrule^:

--- Quote from: jpeters on March 02, 2009, 02:16:27 AM ---needs a "*" (edit: don't think "-l" is necessary :) )

--- Code: ---for x in `ls  /opt/.backgrounds/* | grep -i  "\.\(gif\|png\|bmp\|jpg\|jpeg\)" `
--- End code ---

--- End quote ---
Actually, the * and the -1 (note: it's a one) are not needed.  I usually use -1 by default so I can set IFS, etc if the paths might contain spaces.

jpeters:

--- Quote from: ^thehatsrule^ on March 02, 2009, 02:32:47 PM ---
--- Quote from: jpeters on March 02, 2009, 02:16:27 AM ---needs a "*" (edit: don't think "-l" is necessary :) )

--- Code: ---for x in `ls  /opt/.backgrounds/* | grep -i  "\.\(gif\|png\|bmp\|jpg\|jpeg\)" `
--- End code ---

--- End quote ---
Actually, the * and the -1 (note: it's a one) are not needed.  I usually use -1 by default so I can set IFS, etc if the paths might contain spaces.

--- End quote ---

It doesn't work without the "*" for me. 

^thehatsrule^:
Odd - globbing shouldn't be needed.  What kind of setup/environment do you have?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version