c - rsh is removing double quotes -



c - rsh is removing double quotes -

rsh command removing double quotes in remote shell.

for example: command rsh 10.20.1.25 my_pgm -g "name1 name2" in remote shell my_pgm -g name1 name2

i want double quotes -g alternative in remote shell too. idea?

to escape double quote within string utilize backslash:

rsh 10.20.1.25 my_pgm -g "\"name1 name2\""

actually, c programme sprintf(cmd_string, "rsh 10.20.1.25 my_pgm -g \"name1 name2\"");

ok, mean using system(), see output on echo:

#include <stdlib.h> int main(void) { system("echo \"name1 name2\""); /* output: name1 name2 */ system("echo '\"name1 name2\"'"); /* output: "name1 name2" */ homecoming 0; }

translated yours (note single quote , double quote around name1 name2):

sprintf(cmd_string, "rsh 10.20.1.25 my_pgm -g '\"name1 name2\"'");

or pointed out @nos:

sprintf(cmd_string, "rsh 10.20.1.25 my_pgm -g \\\"name1 name2\\\"");

c rsh

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -