1832994 Members
2518 Online
110048 Solutions
New Discussion

echo command

 
SOLVED
Go to solution
Yair Goldel
Advisor

echo command

why when i do echo "sting\c" in some enviromnet its work
% echo "STRING\c"
SRTING%
and in some environment it doesn't
% echo "STRING\c"
STRING\c
%
How can i control on this phenomenon ?

7 REPLIES 7
Bill McNAMARA_1
Honored Contributor

Re: echo command

you should check the environment variables (env) before running the command. see the man page of echo.

are you running the command via script? what shell?
It works for me (tm)
Bill McNAMARA_1
Honored Contributor

Re: echo command

Is the TERM the same?
It works for me (tm)
Francisco J. Soler
Honored Contributor

Re: echo command

In linux is sighly different than HP-UX and you must pass the -e option to enable special interpretation.

echo -e "string\c"

Frank.
Linux?. Yes, of course.
John Meissner
Esteemed Contributor

Re: echo command

you can also use the print command. It's faster than the echo command and will also allow you to do the same thing.
All paths lead to destiny
James R. Ferguson
Acclaimed Contributor
Solution

Re: echo command

Hi:

Try:

% echo -n "string"

Regards!

...JRF...
Yair Goldel
Advisor

Re: echo command

Which enviroment variable is change this functionality of "\c" in the "echo" command?
James R. Ferguson
Acclaimed Contributor

Re: echo command

Hi (again) Yair:

The man pages for 'echo' note that the Berkeley echo does not implement the backslash escapes. However, the semantics of the '\c' escape can be obtained by using the '-n' option. The echo command implemented as a built-in function of 'csh' follows the Berkeley semantics.

Regards!

...JRF...