delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/04/27/19:08:48

X-Spam-Check-By: sourceware.org
Message-ID: <20060427230838.70271.qmail@web38913.mail.mud.yahoo.com>
Date: Thu, 27 Apr 2006 16:08:38 -0700 (PDT)
From: Siddhartha Shivshankar <s_siddhartha AT yahoo DOT com>
Subject: Variable read error? Multiple spaces
To: cygwin AT cygwin DOT com
MIME-Version: 1.0
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

Hi. After I try to read the contents of a file containing    
multiple spaces into a bash variable, only one space is seen    

in the variable. Output similar to the following 2 space    
example is seen for 3 spaces as well.  Is this an error? If    
so, does anyone know a work-around?   
    
Thanks,    
-Siddhartha.    

---------- Output from bash follows -----------
$ cat>i.txt
Hello  world

$ export b=`cat i.txt`

$ echo $b
Hello world

$ export b=`<i.txt`

$ echo $b
Hello world

$ export b=$(cat i.txt)

$ echo $b
Hello world

$ export b=$(<i.txt)

$ echo $b
Hello world

$ cat i.txt
Hello  world



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--
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