Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Feb 2017 01:26:05 +0000
From:      Manish Jain <>
To:        "" <>
Cc:        "" <>
Subject:   Re: Variable assignment in sh
Message-ID:  <>
In-Reply-To: <>
References:  <> <> <> <> <> <> <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help

On 02/01/2017 06:18 AM, Polytropon wrote:
> Additionally, it helps to write portable scripts (across
> different operating systems), not just for FreeBSD systems

A point here for bash scripting. I earlier used to shebang with the path=20
to bash :


Since my scripts sometimes needed to be ported to Linux and/or Cygwin, I=20
often hacked the system with a symlink /bin/bash that pointed to the=20
actual bash. Then I would use the symlink path - that worked under both=20
FreeBSD and Linux.

But a much better way now exists with env :

#!/usr/bin/env bash

The above shabang always works, no matter what the system, is fully=20
portable, and is not too much typing either.

Manish Jain

Want to link to this message? Use this URL: <>