root /etc/csh

Polytropon freebsd at edvax.de
Fri Nov 14 13:20:30 PST 2008


On Fri, 14 Nov 2008 11:49:35 -0800 (PST), GESBBB <gesbbb at yahoo.com> wrote:
> The point is that I would want it to work seamlessly between
> different flavors of *nix and FBSD. Since there seems to be
> a lack of consistency as to where 'Bash' is installed on
> different OSs, I find that using the notation I described
> works best and seems to improve the portability of the scripts.
> Since most of the scripts that I write are 'Bash' specific
> anyway, the fact that it would not work if Bash was not
> installed is of little importance.

I'm not sure if you can assume /usr/bin/env exactly in this
position on every UNIX system.

In order to gain maximum portability, keep things simple and
try to use sh as scripting shell. If that's not possible, you could
add a check (using "which") for bash's availability, outputting
to stderr if bash is not present, just like a kind of "wrapper
script" that calls your bash specific script. Maybe that's not
very elegant, but it seems to be a good solution.



> By the way, this also works with Perl as you no doubt know. I
> cannot count how many times I have installed a Perl script and
> then had to modify the 'shebang' in order to get it to work in
> FBSD. I know that I could probably make some symbolic links or
> whatever; however, I feel that, that is the wrong way to get
> things to work properly.

That's correct. Adding symlinks to structures controlled by the
package management system or the OS itself can lead into problems.



-- 
Polytropon
>From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list