Skip to main content
14 events
when toggle format what by license comment
Feb 9, 2023 at 16:32 comment added Tripp Kinetics @Graeme SQL? Lua? AppleScript? JavaScript? Swift?
Mar 16, 2014 at 16:47 comment added Graeme @mike the bang line is just a comment to a shell script, probably why so many scripting languages use # for a comment. scheme is the exception on Wikipedia, seemingly it needs to make special provisions - en.wikipedia.org/wiki/Shebang_%28Unix%29
Mar 16, 2014 at 16:29 comment added mikeserv @Graeme That makes a lot of sense. So when a new process is called, does the kernel then filter the hashbang from its first file descriptor? Does the process even see it?
Mar 16, 2014 at 11:36 comment added Graeme Bang lines are interpreted by the kernel. If you exec ./somescript with the bangline #!/bin/sh, it would be equivalent to running /bin/sh ./somescript. Otherwise they make no difference to the shell.
Mar 16, 2014 at 11:12 history edited mikeserv CC BY-SA 3.0
added 6 characters in body
Mar 16, 2014 at 11:02 history edited mikeserv CC BY-SA 3.0
added 47 characters in body
Mar 16, 2014 at 10:40 history edited mikeserv CC BY-SA 3.0
added 47 characters in body
Mar 16, 2014 at 10:38 comment added mikeserv Me too! I think it's because it's a shell builtin. I'm checking...
Mar 16, 2014 at 10:37 comment added toxalot With or without hashbang, I get same results. With or without being executable, I get same results.
Mar 16, 2014 at 10:34 comment added mikeserv Does it have a hashbang? I think that the difference matters - and I can add that - without it sh should not exec it and instead source it, but with it, it should exec it.
Mar 16, 2014 at 10:32 comment added toxalot On my system, if it's sourced (. ./myscript.sh or source ./myscript.sh), then $0 is the shell. But if it's passed as an argument to the shell (sh ./myscript.sh), then $0 is the path to the script. Of course, sh on my system is Bash. So I don't know if that makes a difference or not.
Mar 16, 2014 at 10:25 history edited mikeserv CC BY-SA 3.0
added 54 characters in body
Mar 16, 2014 at 10:19 history edited mikeserv CC BY-SA 3.0
added 54 characters in body
Mar 16, 2014 at 10:13 history answered mikeserv CC BY-SA 3.0