[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: unexpected script output





Le 20.12.2012 00:22, Bob Proulx a écrit :
Nelson Green wrote:
> Nelson Green grabbed a keyboard and wrote:
> Change your shebang line to #!/bin/bash to make it work right and then > set the executable bit on the script. Then you can just do ./output.sh > to get the expected results (don't do "sh output.sh," since that will
> just invoke /bin/sh which points you back to dash).

Oops, I thought I had already linked /bin/sh to /bin/bash, but I
hadn't. I do not like dash, and I have to use bash on a lot of
non-Debian systems, so I try to keep my environment as similar as I
can all the way around.

Don't change the symlink.  Change the #! line to #!/bin/bash.  That
is the correct way to use bash specific features.  Then it will work
on the next system that you run it on.  If you change the symlink on
your system then you try to run the script on a different machine then
it in those immortal words it is deja vu all over again.

Bob

The immediate problem to change the symlink to bash instead of dash is that it will slow down his system boot sequence, because dash is far smaller than dash, which is better for scripts... and init.

Of course, there is also the problem of dash scripts runned with bash, which may have a different behavior.


Reply to: