Link to home
Start Free TrialLog in
Avatar of platiumstar
platiumstar

asked on

use echo

This is probably a very stupid question but how do you use echo to print multiple carriage returns, without retyping
echo
echo
echo
over and over again.
Avatar of ozo
ozo
Flag of United States of America image

echo "\n\n\n"

Avatar of kellyjj
kellyjj

ozo should get the points for this one.
ozo's answer might work in some cases.
But unfortunately most shells have their own implementation of
echo (shell built-in), and this is, --to make make things more
crazy-- different on several platforms.

/bin/echo "\n\n\n"

If you have HP-UX and you're using csh, try to find mcsh on your
system.
should work anywhere.
Avatar of platiumstar

ASKER

that's what I thought, echo "\n\n\n".
but it doesn't work, I tried to get into all the shell's we have but none of them will work.I tried tcsh, csh, sh(bourne shell),
but none of them will work. is there any reason why? I also checked the environmental variables but nothing sets echo.

What does echo "\n\n\n" do for you?
as I said: this is one of the deep secrets (for all those people
who didn't know them;-))

Search for a external program echo:
  find / -name echo -print

Then try following:

   echo "\n\n"
   \echo "\n\n"
   /path/reported/by/find-command/above/echo "\n\n"

you may try it in different shells (sh first).
If you are trying to print lots of text, you could always use a 'here document' instead of echo, thus:

cat <<END_OF_TEXT
line 1
line 2
line 3
.etc
END_OF_TEXT

This way you are only using one command, and it is also easier to see how it would be spaced on the screen.
ASKER CERTIFIED SOLUTION
Avatar of David Williams
David Williams
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial