I am trying to run the following command inside child process exec of nodejs and it is failing:
wget -qO- some.website | awk -F \"</*TD ALIGN=LEFT>|</*TD>|<*/A>\" \'/<TD ALIGN=LEFT>.*[A-Z]/ {print $12}\' | sed -n 1p
I tested the command from a shell script and it runs perfectly. However, when I run it from nodejs it is giving the following error:
/bin/sh: TD: No such file or directory
Please help.
EDIT:
var reportTCC = function() {
let child = exec(configs.command, function(error, stdout, stderr) {
if (error !== null) {
log.error('Error executing the command to retrieve Run Info: ' + error);
stdout = "UNKNOWN"
}
let run_type = stdout;
});
};
configs.command has the command that I am passing
EDIT2:
"command": "ssh -t user@domain 'wget -qO- some.website | awk -F \"</*TD ALIGN=LEFT>|</*TD>|<*/A>\" \"/<TD ALIGN=LEFT>.*[A-Z]/ {print $12}\" | sed -n 1p'",