Reputation: 345
My shellscript looks like
for i in {1..5}
do
echo "Welcome $i times"
exec node nodefile.js
done
and the nodefile.js looks like
console.log 'running nodefile'
When I call the ./shellscript.sh there will only be displayed "Welcome x times" and "running nodefile" once.
Whats missing there? Is there anything that I have to return in nodefile or something else?
Upvotes: 0
Views: 41
Reputation: 321
As an alternative you might try using the 'sha-bang' method.
Put this in your nodefile.js:
#!/the/location/of/your/node
console.log("running nodefile");
Then make the nodefile.js executable by doing:
chmod +x nodefile.js
Now your shell script can look something like this:
for i in {1..5}
do
echo "Welcome $i times"
/location/of/nodefile.js
done
Upvotes: 0
Reputation: 25882
Try this
for i in {1..5}
do
echo "Welcome $i times"
node process.js
done
Upvotes: 1