LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-10-2013, 09:21 PM   #1
oshin159
LQ Newbie
 
Registered: Nov 2013
Posts: 6

Rep: Reputation: Disabled
escape sequences in a string


Hi,
I m new to linux and recently when I tried to user escape sequences with echo command
echo "Hi \n i am a new user" but instead of printing----
Hi
i am a new user
it is printing----
Hi \n i am a new user
i am using ubuntu version 12
Please help!!

Last edited by oshin159; 11-10-2013 at 09:22 PM.
 
Old 11-10-2013, 09:29 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,

there are different versions of echo with different behaviour. For example the zsh builtin echo would do what you want but perhaps you are using /bin/echo, in which case you need to supply the -e option so that escape sequences will be interpreted. Eg
Code:
echo -e "line one\nline two"
HTH,

Evo2.
 
Old 11-11-2013, 03:53 AM   #3
oshin159
LQ Newbie
 
Registered: Nov 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thanx

Thanx evo2 that was really helpfull.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell Scripting escape sequences cmillosh Linux - General 3 10-05-2011 10:29 AM
Less outputs ANSI escape sequences sprocketboy Mandriva 2 08-05-2009 09:22 PM
escape sequences in enscript lanco Linux - Newbie 1 03-01-2009 03:32 PM
How to stop terminal escape sequences ? Mike Davies Linux - Newbie 1 08-08-2004 12:37 PM
Xterm escape sequences GrayGh0st Linux - Software 3 07-19-2003 01:10 AM


All times are GMT -5. The time now is 08:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration