views:

79

answers:

2

Hi, I am writing a python script on Linux for twitter post using API, Is it possible to pass symbols like "(" ")" etc in clear text without apostrophes....

% ./twitterupdate this is me  #works fine
% ./twitterupdate this is bad :(( #this leaves a error on bash.

Is the only alternative is to enclose the text into --> "" ?? like..

% ./twitterupdate "this is bad :(("  #this will reduce the ease of use for the script

Is there any workaround?

+7  A: 

Yes, quoting the string is the only way. Bash has its syntax and and some characters have special meaning. Btw, using "" is not enough, use apostrophes instead. Some characters will still get interpretted with normal quotation marks:

$ echo "lots of $$"
lots of 15570
$ echo 'lots of $$'
lots of $$
Lukáš Lalinský
apostrophes.. oh that will do some good :)
Idlecool
+1 for the *excellent* example.
Dennis Williamson
+1  A: 

http://www.gnu.org/software/bash/manual/bashref.html#Quoting

Paul Hankin
thanks for the link :)
Idlecool