Escape characters

i am executing script from A server which will execute the script in B server , as below.

ssh A 'ssh B echo 'select * from testing where name ='test''

i am getting the below output.
select * from testing where name=test

but i need the output where clause with quotes , tried with escape character (\) , but failed :frowning:

thanks in advance.

Depending on how often the line is evaluated you might need more than one pair of backslashes, because every time the line is interpreted one of these pairs is "interpreted away". Try "\\'" (or maybe "\\\\'", etc.).

I hope this helps.

bakunin

I'm not sure that it works :slight_smile:

ssh A 'ssh B awk 'BEGIN{printf "select * from testing where name =%ctest%c\n",39,39;}' '

awk is giving the error, but got the required output with six slashes \\\\\\ ..

Thanks All ! ! !