Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

use echo

Posted on 1998-10-01
8
Medium Priority
?
369 Views
Last Modified: 2013-12-06
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.
0
Comment
Question by:platiumstar
8 Comments
 
LVL 85

Expert Comment

by:ozo
ID: 2007160
echo "\n\n\n"

0
 
LVL 2

Expert Comment

by:kellyjj
ID: 2007161
ozo should get the points for this one.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2007162
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.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:platiumstar
ID: 2007163
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.

0
 
LVL 85

Expert Comment

by:ozo
ID: 2007164
What does echo "\n\n\n" do for you?
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2007165
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).
0
 

Expert Comment

by:tsmoore
ID: 2007166
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.
0
 
LVL 4

Accepted Solution

by:
davidmwilliams earned 100 total points
ID: 2007167
 Use the -n option to echo - though, note the built-in ksh echo does not have this option, and on certain systems sh may not either, but csh does.  In any case, you will undoubtedly have a binary version of echo that you can use, which supports -n, that is not a shell built-in.
  -n allows you to make up a multi-line echo statement, like this -

echo -n "


   Hi there


"

and then you will get that entire message, including all the blank lines, echoed out.  This works fine in a shell script, or directly on the command line.

Regards,
 David Williams
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question