Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Mon, 14 Feb 2005 18:02:51 -0500 (EST) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: Arthur I Schwarz cc: cygwin AT cygwin DOT com Subject: Re: Bash error in quote handling In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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/