Skip to content
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

Kernel: shebang executables and arguments #585

Closed
tgerdes opened this issue Sep 19, 2019 · 0 comments
Closed

Kernel: shebang executables and arguments #585

tgerdes opened this issue Sep 19, 2019 · 0 comments

Comments

@tgerdes
Copy link

tgerdes commented Sep 19, 2019

Shebang scripts can take arguments, but they're currently being dropped:

anon@courage:/home/anon$> cat test1.sh
#!/usr/local/bin/bash
echo Hello, $1!
anon@courage:/home/anon$> ./test1.sh World
Hello, !

Expected: similar behavior to running through bash directly:

anon@courage:/home/anon$> bash ./test1.sh World
Hello, World!

Similarly, the shebang executable can contain arguments and should be parsed out as such:

anon@courage:/home/anon$> cat test2.sh
#!/usr/local/bin/bash -ex
echo Hello, $1!
anon@courage:/home/anon$> ./test2.sh Sailor
./test2.sh: Command not found.

Expected: this should be executed the same as bash -ex test2.sh Sailor :

anon@courage:/home/anon$> bash -ex ./test2.sh Sailor
+ echo Hello, 'Sailor!'
Hello, Sailor!

Also the error message "Command not found" is confusing in this context; I can clearly see the ./test2.sh file exists and is executable. It might be useful if it output what command wasn't found, in this case when executing ./test2.sh it couldn't find the shebang interpreter /usr/local/bin/bash -ex

@tgerdes tgerdes changed the title shebang executables and arguments Kernel: shebang executables and arguments Sep 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant