0

I have a simple node js program named test_cmd.js. I want to run this program through a unix shell, and use the output of the program to execute a unix command.

test_cmd.js can simply be:

console.log('echo "hello, world!"'); 

Output:

>> pi@raspberrypi ~/ $ node test_cmd.js >> echo "hello, world!" # I want the unix shell I just ran this program in to run this output as a command, but how? 

1 Answer 1

1

You pipe it as stdin to the shell:

$ node test_cmd.js | bash hello, world! 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.