X-Spam-Check-By: sourceware.org To: cygwin@cygwin.com From: Eric Blake Subject: Re: Variable read error? Multiple spaces Date: Thu, 27 Apr 2006 23:31:56 +0000 (UTC) Lines: 32 Message-ID: References: <20060427230838.70271.qmail@web38913.mail.mud.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit User-Agent: Loom/3.14 (http://gmane.org/) X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Delivered-To: mailing list cygwin@cygwin.com Siddhartha Shivshankar yahoo.com> writes: > > 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? It is an error on your part for not quoting properly. But this is not cygwin-specific, so I would advise getting a good tutorial on shell programming and reading it (the web has plenty of resources, google is your friend). > $ export b=`cat i.txt` > > $ echo $b > Hello world Try echo "$b" instead. > > $ export b=$(