Re: For Loops and Space in Names

2008-12-10 Thread Robert Wuest
On Tue, 2008-12-09 at 18:53 -0600, Dave Ihnat wrote: On Wed, Dec 10, 2008 at 11:17:05AM +1100, Cameron Simpson wrote: is totally reliable and does not need $IFS hacking (which amounts to guess a char I might not see in a filename). Hmm...I don't have as much problem with it, but that may

Re: For Loops and Space in Names

2008-12-10 Thread Patrick O'Callaghan
On Thu, Dec 11, 2008 at 5:35 PM, Robert Wuest [EMAIL PROTECTED] wrote: On Tue, 2008-12-09 at 18:53 -0600, Dave Ihnat wrote: On Wed, Dec 10, 2008 at 11:17:05AM +1100, Cameron Simpson wrote: is totally reliable and does not need $IFS hacking (which amounts to guess a char I might not see in a

Re: For Loops and Space in Names

2008-12-10 Thread Cameron Simpson
On 10Dec2008 15:05, Robert Wuest [EMAIL PROTECTED] wrote: | Spaces have always been one of my pet peeves and I find this discussion | rather interesting. Spaces don't belong in filenames and they make | script writing a pain. I'm going to include a script I wrote a long | time ago to handle the

Re: For Loops and Space in Names, take 2

2008-12-10 Thread Robert Wuest
On Thu, 2008-12-11 at 10:02 +1100, Cameron Simpson wrote: Because the $1 is unquoted here you probably don't need the + in the regexps. But you probably should quote $1 because of this: [/Users/cameron]fleet* x='t*' [/Users/cameron]fleet* echo $x t* [/Users/cameron]fleet* echo $x

Re: For Loops and Space in Names, take 2

2008-12-10 Thread Robert Wuest
the $1 is still unsafe, and cannot easily be made safe. (Actually, bash's printf %q formatter may do the trick for you, and since you're already in nonportable GNU sed land, you may as well step right in with nonportable bash too:-) I'm not sure what %q does. It's not in the info or

Re: For Loops and Space in Names, take 2

2008-12-10 Thread Cameron Simpson
On 10Dec2008 20:52, Robert Wuest [EMAIL PROTECTED] wrote: | On Thu, 2008-12-11 at 10:02 +1100, Cameron Simpson wrote: | Because the $1 is unquoted here you probably don't need the + in the | regexps. But you probably should quote $1 because of this: | |[/Users/cameron]fleet* x='t*' |

For Loops and Space in Names

2008-12-09 Thread RGH
Since we were talking here about this last week, I thought I'd mention this: http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html Most of the ideas there are ones that got mentioned here, but there is a new one. rh -- fedora-list mailing list fedora-list@redhat.com

Re: For Loops and Space in Names

2008-12-09 Thread Cameron Simpson
On 09Dec2008 18:24, RGH [EMAIL PROTECTED] wrote: Since we were talking here about this last week, I thought I'd mention this: http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html Most of the ideas there are ones that got mentioned here, but there is a new one. If

Re: For Loops and Space in Names

2008-12-09 Thread Tom Horsley
http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html Most of the ideas there are ones that got mentioned here, but there is a new one. You know, Unix allowed spaces in filenames since before time fell upon the face of the earth (I got that from a documentary on Beavers

Re: For Loops and Space in Names

2008-12-09 Thread Dave Ihnat
On Wed, Dec 10, 2008 at 11:17:05AM +1100, Cameron Simpson wrote: is totally reliable and does not need $IFS hacking (which amounts to guess a char I might not see in a filename). Hmm...I don't have as much problem with it, but that may be because since I started using Unix around 1980, using

Re: For Loops and Space in Names

2008-12-09 Thread Cameron Simpson
On 09Dec2008 18:53, Dave Ihnat [EMAIL PROTECTED] wrote: | On Wed, Dec 10, 2008 at 11:17:05AM +1100, Cameron Simpson wrote: | is totally reliable and does not need $IFS hacking (which amounts to | guess a char I might not see in a filename). | | Hmm...I don't have as much problem with it, but

Re: For Loops and Space in Names

2008-12-09 Thread Dave Ihnat
On Wed, Dec 10, 2008 at 01:31:45PM +1100, Cameron Simpson wrote: Yes, but I wasn't talking about using $IFS for records (which is just dandy), I was talking about the earlier example on the page for coping with spaces in filenames. Ok. BTW, you know that this: ... Yes, I was doing bad

Re: For Loops and Space in Names

2008-12-09 Thread Cameron Simpson
On 09Dec2008 20:55, Dave Ihnat [EMAIL PROTECTED] wrote: | On Wed, Dec 10, 2008 at 01:31:45PM +1100, Cameron Simpson wrote: | BTW, you know that this: ... | | Yes, I was doing bad pseudocode; it usually would be something like: | | exec 0/etc/passwd | while read inline | do |