Pergunta

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
Foi útil?

Solução

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

Outras dicas

I tried

plink user@10.220.60.xx /home/user/test/testpgm arg1

Works fine.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top