RE: [suse-programming-e] line feed
No, Here is the line in my script and the report, hmm? echo "\n############# New /etc/aliases file from Listserv ###############" >> $outfile \n############# New /etc/aliases file from Listserv ############### -----Original Message----- From: Anders Johansson [mailto:andjoh@rydsbo.net] Sent: Wednesday, June 01, 2005 2:26 PM To: suse-programming-e@suse.com Subject: Re: [suse-programming-e] line feed On Wednesday 01 June 2005 23:08, Patrick B. O'Brien wrote:
I usually would use a \n to tell my shell script to line feed but that does not work using Red Hat/Suse /bin/bash.
What exactly is it you would normally do that doesn't work?
How can I tell my /bin/bash shell script to \n line feed without doing an echo " " > $outfile?
adding a \n to the last thing you output doesn't work? echo -e 'This line is terminated by a line feed\n' > $outfile for example -- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-programming-e
Patrick, On Wednesday 01 June 2005 14:31, Patrick B. O'Brien wrote:
No,
Here is the line in my script and the report, hmm?
echo "\n############# New /etc/aliases file from Listserv ###############" >> $outfile
You need to specify the "-e" option (as Anders J. illustrated) to get C-like escape sequences interpreted by the BASH built-in echo command. You can also get the escapes interpreted in the string constants themselves: % echo $'Here comes a newline:\n' (which would yield two newlines, one from echo after the arguments are echoed and one from the string constant itself). The advantage of $'string-with-escapes' is that it works regardless of which command the string is passed to. Randall Schulz
On Wednesday 01 June 2005 5:31 pm, Patrick B. O'Brien wrote:
No,
Here is the line in my script and the report, hmm?
echo "\n############# New /etc/aliases file from Listserv ###############" >> $outfile
\n############# New /etc/aliases file from Listserv ###############
Try: echo -e "\n# New /etc/aliases file from Listserv #########" I've shortened this to prevdent line wrap. Read the man page from echo(1) The -e option enables the escape characters. -- Jerry Feldman <gaf@blu.org> Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
participants (3)
-
Jerry Feldman
-
Patrick B. O'Brien
-
Randall R Schulz