Bash Shell script problem after upgrade
Markus Schönhaber
ubuntu-users at list-post.mks-mail.de
Mon Jan 3 20:03:29 UTC 2011
03.01.2011 18:08, Nils Kassube:
> Linda wrote:
>> I have bash shell scripts that ran under LTS 8.04 and no longer work.
>> They still ask the questions for the variables but the output file
>> is not created. I have tried to keep the bones of the script and
>> have gotten rid of most of the content that is echoed to the file. I
>> tried commenting out the lpr command and the file is not created.
>> Why would this file that has worked since the 1980s no longer create
>> a file with LTS 10.04. Thanks
>> Linda
>>
>> # Rprice_ prints price list
>> #!/bin/bash
>
> Not sure if these two lines are the only problem but at least the
> sequence is wrong. The "#!/bin/bash" line should be the first one to
> select bash instead of sh. IIRC, in 8.04 /bin/sh was still linked to
> /bin/bash and therefore your script used bash because it was the default
> anyway. In later Ubuntu versions /bin/sh is linked to /bin/dash which
> doesn't know the bash extensions.
No, sh is dash by default on Hardy. It is this way since Edgy:
https://wiki.ubuntu.com/HardyReleaseNotes#/bin/sh%20is%20now%20dash
https://wiki.ubuntu.com/DashAsBinSh
Nevertheless, fixing the broken shebang would be sensible first step.
And a sensible second step might be to try to find out what *exactly*
goes wrong. Using the '-x' parameter of the shell could be helpful wrt
to this.
At least I don't see any problem with the OP's shell script - regardless
whether I feed it to dash or bash.
--
Regards
mks
More information about the ubuntu-users
mailing list