David C. Rankin wrote:
On 05/22/2012 02:28 PM, Dirk Gently wrote:
why are you running sh filename.sh
when the first line of filename contains this interpreter definition: #!/bin/bash
should be bash filename.sh
(but I usually just save the 2 chars.. :)
Seriously,
In nearly 15 years of this, I can count on one hand and still have fingers left the number of times 'sh foo.sh' has caused issues where 'bash foo.sh' did not. I guess the habit of 'sh scriptname.sh' just comes from the thousands of examples read where 'sh foo.sh' is given. In all the script examples I've seen, I think there has only been 1 or 2 examples that have shown using 'bash foo.sh'. I guess the example writers are human and lazy too.
Once you set the executable bit on a script with an interpreter defined on the first line with the #!/path/to/interpreter mechanism, there's no reason to write bash foo nor python parrot for that file ever again. I ALWAYS chmod my shell scripts, and then just use them as if it were any other executable.
The only place I generally explicitly call bash is when rebooting to recover/replace a root password using: init=/bin/bash in the kernel line in grub. I guess I should make a point of using the interpreter specified after the #! in the future :)
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org