1833115 Members
2886 Online
110051 Solutions
New Discussion

About echo

 
Juno
Occasional Advisor

About echo

I am new comer to unix, i have a very simple question about writing a script
How can I open a new line when use the command 'echo' ? I know the ???\n??? function can make a new line , but I only know to use it in printf.

% echo aaa bbb
my target result is
% echo aaa bbb
aaa
bbb

sorry to ask such simple question there, but I really urgently need to know.
Juno
5 REPLIES 5
Robin Wakefield
Honored Contributor

Re: About echo

Hi,

# echo "aaa\nbbb"
aaa
bbb

will do it.

Rgds, Robin
Yogeeraj_1
Honored Contributor

Re: About echo

hi,

similar to printf use \n.

E.g.
root-L1000 #echo "\t hello \n world"
hello
world
root-L1000 #


Hope this helps!

Best Regards
Yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Juno
Occasional Advisor

Re: About echo

Thx all reply,
I can make it in UNIX but can't in linux , can suggest how to make it in linux ? thx.
Juno
Yogeeraj_1
Honored Contributor

Re: About echo

hi
try:
echo -e "An apple a day keeps away \a\t\tdoctor\n"

should be OK!

See also:
http://www.freeos.com/guides/lsst/getting.htm#echocm


Regards

Yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Juno
Occasional Advisor

Re: About echo

It is OK, thx all
Juno