Say I have my.script
such as
#!/bin/bash
blah
blah
and the bash interpreter accepts a --verbose
argument.
How do I execute my.script passing –verbose to bash?
I know I can do bash –verbose my.script on the command line, but I need to be able to run my.script
directly.
EDIT:
Ok, maybe I should have described my exact example. I'm using grunt.js build system whose cli is a script with a #! to node. Now, grunt runs plugins and one such plugin I use needs a certain flag to be enabled on node. The grunt cli script doesn't do that and I don't want to change it.
Best Answer
You can add
--verbose
to the shebang line:If you’re running this on Linux, because of the way the kernel handles shebang lines, you can only add one parameter in this way. In shell scripts you can control certains shell options using
set
; in this instance(Although that will only show commands after the
set
line, whereas having--verbose
in the shebang line shows all the commands, including the shebang.)