Re: manpage note? weird strings that appear to be equal but create haywire comparisons?

2009-09-01 Thread Linda Walsh
Chet Ramey wrote: Note that [[ and [ return different results when the vars are unquoted. Yes. There are two differences. First, the operands in [[ do not undergo all word expansions. The arguments to [, since it's a builtin, do. That doesn't really matter to this example, but it's worth no

Re: manpage note? weird strings that appear to be equal but create haywire comparisons?

2009-08-26 Thread Chet Ramey
Linda Walsh wrote: > But then I tested equality on the strings and that's the confusing > part. I have an idea of what's going on but boy do string compares look > confused. They perform same on cygwin > (bashv=3.2.49(22)-release (i686-pc-cygwin)) and Suse11.1: > (bashv=3.2.39(1)-release (x86_64-

Re: manpage note? weird strings that appear to be equal but create haywire comparisons?

2009-08-26 Thread Linda Walsh
Greg Wooledge wrote: On Wed, Aug 26, 2009 at 02:45:39AM -0700, Linda Walsh wrote: I had a var 'c' set to (no quotes in the var): 'C\windows\system32' How did you assign this value? Did you read it from a file? Did you type a specific bash command? -- I typed it in at the prompt as:

Re: manpage note? weird strings that appear to be equal but create haywire comparisons?

2009-08-26 Thread Pierre Gaston
On Wed, Aug 26, 2009 at 4:19 PM, Greg Wooledge wrote: > Assuming the first part was supposed to be var='"*"' ... > yup > > The bash command [[ \* = $var ]] returns true if $var contains a glob > pattern against which a literal asterisk * can be matched. (By the way, > you don't need the \ there

Re: manpage note? weird strings that appear to be equal but create haywire comparisons?

2009-08-26 Thread Greg Wooledge
On Wed, Aug 26, 2009 at 04:36:42PM +0300, Pierre Gaston wrote: > Thanks, I agree with that, I'm sorry I should have been more explicit, > what was not clear to me was where this special role of the \ is explained, > Because if you use literals [[ something = \* ]] is the same as [[ > something = "

Re: manpage note? weird strings that appear to be equal but create haywire comparisons?

2009-08-26 Thread Greg Wooledge
On Wed, Aug 26, 2009 at 02:45:39AM -0700, Linda Walsh wrote: > I was scripting and fixing some permissions in Win, > and had a var 'c' set to (no quotes in the var): 'C\windows\system32' How did you assign this value? Did you read it from a file? Did you type a specific bash command? > # ech

Re: manpage note? weird strings that appear to be equal but create haywire comparisons?

2009-08-26 Thread Pierre Gaston
On Wed, Aug 26, 2009 at 12:45 PM, Linda Walsh wrote: > I was scripting and fixing some permissions in Win, > and had a var 'c' set to (no quotes in the var):   'C\windows\system32' > I first bumped into this using the printf -v var "%q" feature, where > I expected it to doublequote the back slash

manpage note? weird strings that appear to be equal but create haywire comparisons?

2009-08-26 Thread Linda Walsh
I was scripting and fixing some permissions in Win, and had a var 'c' set to (no quotes in the var): 'C\windows\system32' # echo $v |hexdump -C 43 3a 5c 77 69 6e 64 6f 77 73 5c 73 79 73 74 65 |C:\windows\syste| 0010 6d 33 32 0a |m32.|