delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/02/14/18:10:29

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Subject: Re: Bash error in quote handling
To: cygwin AT cygwin DOT com
Cc: cygwin AT cygwin DOT com
Message-ID: <OF1CC5A7F4.9E66184B-ON88256FA8.007F1D63-88256FA8.007F3199@mck.us.ray.com>
From: Arthur I Schwarz <Arthur_I_Schwarz AT raytheon DOT com>
Date: Mon, 14 Feb 2005 15:09:15 -0800
MIME-Version: 1.0
X-SPAM: 0.00

Igor;

Thank your for your explanation.

art



                                                                                                                      
                      Igor                                                                                            
                      Pechtchanski             To:      Arthur I Schwarz <Arthur_I_Schwarz AT raytheon DOT com>              
                      <pechtcha AT cs DOT nyu         cc:      cygwin AT cygwin DOT 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/
      |\      _,,,---,,_                         pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_                     igor AT watson DOT ibm DOT com
     |,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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019