-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Interpreter: execute via shell #6
Conversation
Thank you, Ryan, for the suggestion. I think this just moves the problem Everyone, is it unreasonable to ask that node be on the user's path so that The remaining problem is that some users experience end of line or script On Wed, Oct 21, 2015 at 11:06 PM, Chalos Yance Lawrence <
|
TL;DR: Common / best / essential practice for portability is to use absolute paths in the she-bang line and avoid putting a carriage-return at end-of-line (i.e. use unix format, not DOS.)
I have node on the path, but you'll see (on OSX at least) a bare $ which -a node
/usr/local/bin/node
$ ls -l relative.sh using-env.sh
-rwxr-xr-x 1 ash staff 27 6 Dec 14:20 relative.sh
-rwxr-xr-x 1 ash staff 40 6 Dec 14:22 using-env.sh
$ cat relative.sh && ./relative.sh
#!node
console.log("OK");
-bash: ./relative.sh: node: bad interpreter: No such file or directory
$ cat using-env.sh && ./using-env.sh
#!/usr/bin/env node
console.log("OK");
OK If I look at the other npm packages I've got installed, I see EVERY OTHER node script is installed with $ head -1 $(npm config get prefix)/bin/* | grep '#!' | sort | uniq -c
23 #!/usr/bin/env node
4 #!node Those 4 scripts using Second issue, unix vs DOS file format - your scripts (in DOS format) aren't recognised as executables - checked using $ cd $(npm config get prefix)/bin
$ file *
babel: a node script text executable
babel-node: a node script text executable
bower: a node script text executable
...
github-markdown: ASCII C++ program text, with CRLF line terminators
github-markdownb: ASCII C++ program text, with CRLF line terminators
markdown: ASCII C++ program text, with CRLF line terminators
markdownb: ASCII C++ program text, with CRLF line terminators
...
webpack: a node script text executable
webpack-dev-server: a node script text executable
yo: a node script text executable If I JUST change the shebang line, I end up with: $ markdownb
env: node\r: No such file or directory After changing the file-format to unix (and therefore removing the carriage return after |
would be the same as this:
I suppose I could see how no STDOUT redirection is desired, perhaps my expectation was uncommon. I was also hoping to full HTML scaffolding, with embedded default CSS style. l. |
Hi, @cwjohan
This is fixes #2
why use shell or why not use she-bang solution?
node installed location is differ from others, so sha-bang would also differ from others.
instead of changing
#!node
to
problem still there.
safer way to execute command
So write the command in shell script, let the shell script execute the command
replace markdown with shell script
rename markdown to markdown_main