delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/05/29/11:21:04

X-Spam-Check-By: sourceware.org
Date: Tue, 29 May 2007 11:20:35 -0400 (EDT)
From: Igor Peshansky <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: John <jhy001 AT earthlink DOT net>
cc: cygwin AT cygwin DOT 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 DOT 4090502 AT earthlink DOT net> <20070526145859 DOT GA3313 AT ednor DOT casa DOT cgf DOT cx> <n2m-g DOT 325e20f89d73c895d99cc7a3cc71263f AT crystal DOT laburec DOT de> <46585D7D DOT 1070805 AT earthlink DOT net> <20070526170712 DOT GA18329 AT trixie DOT casa DOT cgf DOT cx> <4658FB50 DOT 8060101 AT earthlink DOT net> <4658FCBB DOT 8030909 AT earthlink DOT net>
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
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

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 AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT 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/

- Raw text -


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