I was looking at this example here:
https://bbs.archlinux.org/viewtopic.php?id=168479
It says I can execute JS/Node.js this way:
#!/bin/sh
exec node --harmony <<EOF
console.log("hello")
EOF
Does that make any sense to anyone? What exactly is going on?
After some Googling looks like this pulls the data between the EOF chars into stdin.
If this is possible it will allow me to solve a particular problem - namely using whichever node executable is on the user $PATH, whilst still pass the node executable flags (in this example, it's "--harmony").
If you look at the link, you only have to go down just a bit to see the code above.
Can anyone explain what this EOF syntax is about?
One specific problem I have, is that I cannot run this code:
My guess is that we are passing stdin to the Node.js executable, and for some reason it's not able to resolve paths correctly -
even though cli.js is in the same directory as cli-inspect.sh, require function is not working. In the first line we see that __dirname is ".", normally that would not be the case.


Here Documenten.wikipedia.org/wiki/Here_document#Unix_shells