plink user@10.220.60.xx -t '/home/user/test/testpgm'
I'm able to run the below program which resides on a Linux machine from a windows machine using the above plink cmd.
#include<stdio.h>
int main(int argc,char *argv[])
{
int i;
char buf[30];
printf("Test Pgm \n");
printf("No of Arguments=%d\n",argc);
printf("Enter a string:");
fflush(stdout);
gets(buf);
printf("Input str:%s \n",buf);
return 0;
}
gcc test.c -o testpgm
Question: How to pass command line arguments to this function? I tried
plink user@10.220.60.xx -t '/home/user/test/testpgm arg1'
bash: /home/user/test/testpgm arg1: No such file or directory
The shell treats strings inside quotes as a single word, which means that plink
tries to execute the program /home/user/test/testpgm arg1
. Obviously this won't work.
What you have to do is very simple: Skip the quotes!
$ plink user@10.220.60.xx -t /home/user/test/testpgm arg1
I tried
plink user@10.220.60.xx /home/user/test/testpgm arg1
Works fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.