newline in echo | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

newline in echo

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-19-2010
rikyer rikyer is offline
Registered User
 
Join Date: Jan 2010
Last Activity: 20 January 2010, 5:52 AM EST
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
newline in echo

Hi all,
I have a scripts in csh and whenI do echo command I want to add newline.
I used to do it like this:

Code:
#! /bin/csh
echo "\n\n WHAT AREA DO YOU WANT:\n\n"
echo -n "     YOUR CHOISE : "
set area=$<

but since weupgrade the oracle to 10g it doesn't do the newline (he print the\n as a text).
I try to do echo -e but the same problem (he also print the -e).
the echo -e only work is sh command but not un csh witch I need in order for his to know the echo -n....
I allso try adding enter in the echo but I got error.

do you know how can I do it?

Last edited by Scott; 01-19-2010 at 07:10 AM.. Reason: Please use code tags
Sponsored Links
    #2  
Old 01-19-2010
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
who?
 
Join Date: Dec 2003
Last Activity: 22 September 2014, 9:29 PM EDT
Location: /dev/ph
Posts: 4,809
Thanks: 63
Thanked 425 Times in 394 Posts
Try using /bin/echo when you want to process escape characters such as \n.
Sponsored Links
    #3  
Old 01-19-2010
methyl methyl is offline Forum Advisor  
Advisor
 
Join Date: Mar 2008
Last Activity: 18 April 2014, 5:13 AM EDT
Posts: 6,396
Thanks: 287
Thanked 672 Times in 642 Posts
Try this:


Code:
#!/bin/csh
echo ""
echo ""
echo "WHAT AREA DO YOU WANT:"
echo ""
echo ""
echo "     YOUR CHOISE : \c"
set area=$<


Failing that, please state your Operating System.

Last edited by methyl; 01-19-2010 at 08:54 AM.. Reason: Removed space from shebang line
    #4  
Old 01-20-2010
rikyer rikyer is offline
Registered User
 
Join Date: Jan 2010
Last Activity: 20 January 2010, 5:52 AM EST
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks

I dont want to do echo "" for each enter because this is a long script and it will be even longer.
our system change to RHEL.
from some serch I saw thet there may by an envairment that I need to add to the script but I dont know what (still looking)
if you have some idea or other ideas I will be happy to try it.
Sponsored Links
    #5  
Old 01-20-2010
xoops xoops is offline
Registered User
 
Join Date: Aug 2009
Last Activity: 29 March 2012, 3:19 AM EDT
Posts: 124
Thanks: 0
Thanked 7 Times in 7 Posts
you can write a function which will print the output in desired format and then you can call this function instead of echo.
something like..

Code:
 
function echo2()
{
echo ""
echo "$1"
echo ""
}
 
echo2 "print this"

please ignore the syntax error, not sure if its correct.
Sponsored Links
    #6  
Old 01-20-2010
rikyer rikyer is offline
Registered User
 
Join Date: Jan 2010
Last Activity: 20 January 2010, 5:52 AM EST
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
not so practical

I have some menu and it goes from one to one (depent of the user choise) so I will have to get lt of functions...
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to correctly use an echo inside an echo? mokachoka UNIX for Dummies Questions & Answers 3 09-19-2009 11:40 PM
Difference between using "echo" builtin and /bin/echo ulidtko Shell Programming and Scripting 2 07-15-2009 11:12 AM
echo without newline character srilaxmi UNIX for Dummies Questions & Answers 2 11-10-2008 11:11 AM
replace a newline (\n) jeter Shell Programming and Scripting 3 05-18-2008 10:37 PM
newline Gale Gorman Forum Support Area for Unregistered Users & Account Problems 2 05-04-2008 12:23 PM



All times are GMT -4. The time now is 12:19 AM.