Re: [AMBER] /bin/sh /bin/dash

From: Jason Swails <jason.swails.gmail.com>
Date: Sat, 2 Jul 2011 13:26:25 -0600

Hello,

As the OP of this advice, I'll say this: I think this was a fairly old
post. Indeed, the dash startup time is 'significantly' shorter than bash,
or so I've been told (which is the reason it was made the default /bin/sh in
Ubuntu). However, I've never seen any real difference since switching over
to bash (or since switching back to dash).

That said, #!/bin/sh was used explicitly instead of /bin/bash in Amber
because we wanted to avoid requiring bash in obscure systems (in the spirit
of generality). However, bash allows a lot of syntax that is not strictly
POSIX-compliant. Since most systems that I've come into contact with (most
Linux distros, Mac, and Cygwin) use bash as the default /bin/sh, bash is
typically the shell used to debug/validate any shell script.

An effort has been made to rewrite the non-POSIX compliant parts of the
Amber-distributed scripts so that it'll work with (hopefully) any valid
/bin/sh (meaning, in practice, that developers using Ubuntu get it to work
with dash). Later AmberTools distributions (i.e. 1.4, 1.5 and Amber 11)
*should* be dash-compliant such that this advice is no longer necessary, but
I don't think these issues were worth considering "bugs" worthy of a patch
in Amber10/AmberTools 1.2.

Also, as I recall, Amber was not the only package to make this mistake; so
part of the reason I suggested this approach was to solve related issues in
other comp. chem. packages other users would try to install.

All the best,
Jason

On Sat, Jul 2, 2011 at 11:08 AM, Francesco Pietra <chiendarret.gmail.com>wrote:

> I am at amber10/ambertools1.2 with Denian amd64 wheezy and met the
> same issue discussed below on the Amber web site:
>
>
> As for confirmation about /bin/sh, I too use Ubuntu. The first thing I did
> when I began setting up my environment was to redirect /bin/sh to /bin/bash
> rather than /bin/dash, since it causes a lot of headaches. You could, of
> course, go through the Amber source tree and change #!/bin/sh to
> #!/bin/bash
> to make it use the proper shell, but this issue is pervasive enough that I
> think it is worth changing /bin/sh permanently.
>
> If you google "Bad fd number", you will see countless hits of people saying
> "Ubuntu links /bin/sh to dash rather than bash." (since /bin/sh is a
> symbolic link to /bin/dash). The almost unanimous fix for this issue is
> something along the lines of "sudo rm /bin/sh; sudo ln -s /bin/bash
> /bin/sh"
> to make /bin/sh point to /bin/bash. It would be worth seeing if this fixes
> the issue.
>
> Any script that uses #!/bin/csh should be fine since it explicitly calls
> cshell as long as you have cshell installed (which Ubuntu does NOT come
> with
> by default, but can be obtained via apt-get install csh). Same with
> #!/bin/bash.
>
> Hope this helps,
> Jason
>
> The suggestion helps but the solution should be quite another. /bin/sh
> was made dash because it is smaller and faster. In a code uses bash,
> it had to state that explicitly. One can't imagine if it is bash or
> something else. In my view the solution is to fix the buggy script.
>
> thanks
> francesco pietra
>
> _______________________________________________
> AMBER mailing list
> AMBER.ambermd.org
> http://lists.ambermd.org/mailman/listinfo/amber
>



-- 
Jason M. Swails
Quantum Theory Project,
University of Florida
Ph.D. Candidate
352-392-4032
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Sat Jul 02 2011 - 12:30:03 PDT
Custom Search