Igor;

Thank your for your explanation.

art



                                                                                
                                      
                      Igor                                                      
                                      
                      Pechtchanski             To:      Arthur I Schwarz 
<[EMAIL PROTECTED]>              
                      <[EMAIL PROTECTED]         cc:      cygwin@cygwin.com     
                                        
                      .edu>                    Subject: Re: Bash error in quote 
handling                              
                                                                                
                                      
                      02/14/2005 03:02                                          
                                      
                      PM                                                        
                                      
                      Please respond                                            
                                      
                      to cygwin                                                 
                                      
                                                                                
                                      
                                                                                
                                      



On Mon, 14 Feb 2005, Arthur I Schwarz wrote:

> I think this is an error?

Huh?  What is?  What exactly are the commands you're trying to run?  What
exactly is the output?  What is wrong with the output?

Let me try to guess (below):

>  a. star="*"; echo $star
>  b. star=*;   echo $star

You're saying that the above commands produce the contents of the
directory, and that this is correct.

>  c. star='*'; echo $star
>  d. star=\*;  echo $star

The above commands produce the contents of the directory, and you think
this is incorrect (should be a literal "*").

>  e. star='\*'; echo $star
>  f. star="\*"; echo $star

The above commands produce the string "\*", and you think it should be
"*".

AFAIK, the above is all expected behavior.

The first four commands (a.-d.) set the variable "star" to the same exact
value, namely, the literal "*".  When the shell sees $star, it expands the
contents of it (which is a "*" wildcard), so you get the contents of the
directory.  The manner of quoting you used when assigning the value of the
variable is irrelevant.

If you want echo to produce a literal "*", use 'echo "$star"' (double
quotes to allow variable substitution but prevent shell expansion).

Frankly, at the moment I can't think of a reason why the last two commands
produce "\*" (it's not a nullglob issue, as I first thought).  I'm
reasonably sure it's also expected, but I'll investigate the actual reason
later.
HTH,
             Igor
--

http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_                         [EMAIL PROTECTED]
ZZZzz /,`.-'`'    -.  ;-;;,_                     [EMAIL PROTECTED]
     |,4-  ) )-,_. ,\ (  `'-'                    Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL          a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply via email to