how to handle character ) in bash shell?
i have a script where i need to pass an argument "1234:-)"
if i run this as ./shell.sh 1234:-) it wont work because invalid character. i need to handle this with expect utility so if i pass it as ./shell.sh "1234:-\)" no issue in bash but expect does not recognize this. how to handle this |
What about single quotes?
Code:
./shell.sh '1234:-)' |
Expect works fine, without escaping:
Code:
|
I'm trying single quotes ..
it seems both single and double quotes are same. :( if i pass ./shell.sh '1234:-\)' from bash i dont get any error. when it goes to expect it will be 1234:-). this is what i expect, but still im getting message "incorrect password" |
Please, try double or single quotes without the escaped parenthesis (as shown in the examples above):
Code:
./shell.sh "1234:-)" Code:
./shell.sh '1234:-)' |
Or maybe if passing through a bash script to the expect script you need quotes within quotes to keep it all together:
Code:
./shell.sh "'1234:-)'" |
ok now im trying to replace that character ) with dot . (or some thing else) when required i will replace it back to ). so that my code works. but now how do i replace string in sh script
:( new to linux |
Within single quotes, nothing is substituted, and backslashes are interpreted literally.
Within double quotes, some things still are substituted. To learn more about BASH scripting, see the "LinuxCommand" tutorial (there's a link in my sig). |
All times are GMT -5. The time now is 01:23 PM. |