0
Inside my simple awk script, I call system command
#!/bin/bash
Test='/home/software/Other/new (Applet)'
ls "${Test}"
var=$(ls "${Test}")
echo $var
awk -vTest="$var" 'BEGIN {
#some code that works
print "This is a test", Test
#command= "ls new (Applet)"
system ("ls " Test); }'
The problem is the error with the ()'s
$./testhere.sh
/home/software/Other/new (Applet) /home/software/Other/new (Applet)
This is a test /home/software/Other/new (Applet)
sh: -c: line 0: syntax error near unexpected token ('
sh: -c: line 0:
ls /home/software/Other/new (Applet)'
When I modified the part so that the command is passed as a string
command= "ls new (Applet)"
system (command);
I am getting similar errors:
$ ./testhere.sh
/home/software/Other/new (Applet)
/home/software/Other/new (Applet)
This is a test /home/software/Other/new (Applet)
sh: -c: line 0: syntax error near unexpected token ('
sh: -c: line 0:
ls new (Applet)'
How do I get around this?