X-Spam-Check-By: sourceware.org
Date: Tue, 29 May 2007 11:20:35 -0400 (EDT)
From: Igor Peshansky <pechtcha@cs.nyu.edu>
Reply-To: cygwin@cygwin.com
To: John <jhy001@earthlink.net>
cc: cygwin@cygwin.com
Subject: Re: echo with no line feed
In-Reply-To: <4658FCBB.8030909@earthlink.net>
Message-ID: <Pine.GSO.4.63.0705291033250.29943@access1.cims.nyu.edu>
References: <4657D057.4090502@earthlink.net> <20070526145859.GA3313@ednor.casa.cgf.cx>  <n2m-g.325e20f89d73c895d99cc7a3cc71263f@crystal.laburec.de>  <46585D7D.1070805@earthlink.net> <20070526170712.GA18329@trixie.casa.cgf.cx>  <4658FB50.8060101@earthlink.net> <4658FCBB.8030909@earthlink.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Sat, 26 May 2007, John wrote:

> I can't get:
>
> #! /bin/sh
> echo "Type file name: \c"
> read FNAME
> echo $FNAME
> #
>
> to work without the line feed (using " or ' quotes
> in the echo). Any tips?

'\c' is an escape sequence that prompts 'echo' to disable the trailing
newline.  However, you have to tell 'echo' to look for escape sequences,
i.e.,

echo -e "Type file name: \c"

(quotes don't matter).  Alternatively, as Isaac said, both '/bin/echo' and
the bash 'echo' builtin support the '-n' option to avoid the trailing
newline, i.e.,

echo -n "Type file name: "

(in which case you won't need the '\c').
HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha@cs.nyu.edu | igor@watson.ibm.com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Freedom is just another word for "nothing left to lose"...  -- Janis Joplin

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

