-2

I want to do

/usr/bin/bash myscript.sh -args

which, as it stands, runs the script but doesn't pass the args to it. I realize that the conventional syntax is simply

./myscript.sh -args

but I'm curious as to what I need to do in order to call the script from bash explicitly.

Trey Parkman
  • 59
  • 1
  • 3

2 Answers2

1

Try running the script in debug output mode

/usr/bin/bash --verbose myscript.sh -args
Mike
  • 21,910
  • 7
  • 55
  • 79
0

Please provide information about your operating system. Having 'bash' located at "/usr/bin/bash" tips me off that you're probably not running one of the more common GNU/Linux distributions.

On that note, what does the she-bang of the script look like? If it's any different from the following, then you're not doing the equivalent with your bash command:

#!/usr/bin/bash

One other suggestion I can pull out of the blue is to try escaping the parameters to bash, just in case there's some strange getopt thing going on.

/usr/bin/bash -- myscript.sh -args
  • And change permission so the file can be executed: chmod a+x file (or u+x if you want make it executable only to the user) – PiL Jul 12 '10 at 07:13