Mail Archives: cygwin/2007/05/29/11:21:04
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 -