Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

echo using single quotes

Shell Programming and Scripting


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 10-26-2007
chella chella is offline
Registered User
 
Join Date: Oct 2007
Last Activity: 30 March 2009, 6:42 AM EDT
Posts: 75
Thanks: 0
Thanked 2 Times in 2 Posts
echo using single quotes

Hi,

Please help me to echo the following statement using single quotes

Why can't I write 's between single quotes

Thanks in advance,
Chella
Sponsored Links
    #2  
Old Unix and Linux 10-26-2007
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 27 May 2015, 4:58 PM EDT
Location: NM
Posts: 10,454
Thanks: 337
Thanked 860 Times in 799 Posts

Code:
echo "Why can't I write 's between single quotes"

Sponsored Links
    #3  
Old Unix and Linux 10-26-2007
earnstaf earnstaf is offline
Registered User
 
Join Date: May 2007
Last Activity: 15 November 2012, 10:53 PM EST
Posts: 113
Thanks: 0
Thanked 0 Times in 0 Posts
If I understand your problem, you are trying to do:

Code:
echo 'why doesn't this work?'

You'll need to escape the inner ' so it is seen literally.


Code:
echo 'shouldn\'t this work fine?'

    #4  
Old Unix and Linux 10-29-2007
chella chella is offline
Registered User
 
Join Date: Oct 2007
Last Activity: 30 March 2009, 6:42 AM EDT
Posts: 75
Thanks: 0
Thanked 2 Times in 2 Posts
Thank You for the reply.

But still I am not able to get the required output.

echo 'shouldn\'t this work fine?'

when I tried the above statement it asks to use another single quote at the end.

Please help me.

Regards,
Chella
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Having a terrible problem with quotes/single quotes! jondecker76 Shell Programming and Scripting 2 07-27-2011 04:22 AM
Replace single quote with two single quotes in perl DushyantG Shell Programming and Scripting 3 04-07-2011 02:16 AM
grep single quotes or double quotes george_vandelet UNIX for Dummies Questions & Answers 2 10-27-2010 11:23 AM
problem with echo inserting single quotes jelloir Shell Programming and Scripting 7 09-12-2010 04:40 AM
Single quotes and double quotes sol_nov Shell Programming and Scripting 5 09-16-2009 09:44 PM



All times are GMT -4. The time now is 05:56 PM.