2

This is what I want to do

system("echo "$(cat test.txt)"");

i.e I want to pass the command: echo "$(cat test.txt)" to system().

But keeps giving me compilation error :

init.c: In function 'main':
init.c:19:3: error: 'echo' undeclared (first use in this function)
init.c:19:3: note: each undeclared identifier is reported only once for each function it appears in
init

The argument of system is not becoming a constant string, even after putting double qoutes.

How do I resolve this ?

Uzair
  • 121
  • 1
  • 10

1 Answers1

3

Escape the inner quotes

system("echo \"$(cat test.txt)\"");
P0W
  • 46,614
  • 9
  • 72
  • 119