I want to run bash script with params in node js child_process.exec()
In doc is String The command to run, with space-separated arguments
, but
child.exec("cat path_to_file1 path_to_file2")
doesn't work. It is internally changed to
/bin/sh -c cat path_to_file1 path_to_file2
which fails. How can I run this correctly? In shell I would fix it this way
/bin/sh -c 'cat path_to_file1 path_to_file2'
(I didn't write callbacks, because I ask only about command param)
exec("cat file1 file2")
works correctly. – Chud