This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: echo with no line feed


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]