0

I am processing the values passed into my c program and it works except when a parameter is enclosed in <>. I am assuming that means its not a parameter, but I need to understand what it is and how to process it.

In the second block I pass in key2 and it prints out but not in the first one.

dhruv@dhruv-MS-7B79:~/Documents/GSU/DataSec/test2$ ./worm key < file >
bash: syntax error near unexpected token `newline'


dhruv@dhruv-MS-7B79:~/Documents/GSU/DataSec/test2$ ./worm key key2
key
key2

My end goal is to strip out the filename from inside < file > so that I can pipe it to another program.

Here is the bit of code I am using to concatenate all the parameters:

  for(int i = 1 ; i < argc ; i++){
    strcat(buffer, " ");
    strcat(buffer, argv[i]);
    char* temp = edit_a(argv[i]);
  }

edit is meant to pull out the filename

AProgrammer
  • 51,233
  • 8
  • 91
  • 143
Dhruv
  • 645
  • 9
  • 17

0 Answers0