Addition in bash

David N. Lombard dnl at speakeasy.net
Thu Oct 15 23:41:37 UTC 2009


Florian Diesch wrote:
> "David N. Lombard" <dnl at speakeasy.net> writes:
> 
>> Florian Diesch wrote:
>>> James Michael Fultz <croooow at gmail.com> writes:
>>>
>>>> * David N. Lombard <dnl at speakeasy.net> [2009-10-14 06:23 -0700]:
>>>>> Ray Parrish wrote:
>>>>>>> #!/usr/bin/env bash
>>>>> #!/bin/bash
>>>>>
>>>>> env is used when you don't know the absolute path of the binary.  bash 
>>>>> is /bin/bash--to move it elsewhere would cause intense carnage.
>>>> Generally a safe assumption on GNU/Linux, but not so on other Unix-like
>>>> platforms.  It could be '/usr/pkg/bin/bash' on NetBSD, or
>>>> '/usr/local/bin/bash' on FreeBSD or Solaris, etc.
>>> If you want a script to run on other platforms you should try to use
>>> POSIX /bin/sh instead of bash.
>> Fortunately, modulo the shbang line, everything discussed so far on this 
>> thread has also been POSIX and Korn compatible.
> 
> [[ ... ]] is bash-specific

http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html

-- 
dnl




More information about the ubuntu-users mailing list