Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Feb 2017 17:23:13 +0100
From:      Polytropon <>
To:        Roger Pate <>
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 Wed, 1 Feb 2017 10:06:33 -0500, Roger Pate wrote:
> On Tue, Jan 31, 2017 at 8:26 PM, Manish Jain
> <> wrote:
> > A point here for bash scripting.
> Most often, but not always, if I need something bash has and /bin/sh
> lacks, it's time to write that script in a different language. :P

Don't confuse sh with bash, they're not fully interchangeable.
While sh ("classic Bourne shell") is quite portable and usually
POSIX, bash is not. Even on Linux, sometimes bash != bash, and
sometimes it's dash. You can see bash as a superset of sh, so
you can do testing of sh scripts with bash quite well, even
in the "line by line" interactive manner.

If you need stuff to work across different operating systems,
sh is often called "lowest common denominator" as most UNIX
systems default to it as scripting shell. If you need "bash-isms"
(features that bash has, but sh doesn't), there are also some
portable ways to deal with the shebang line, but don't assume
that bash is installed everywhere as /bin/bash. :-)

Of course you are right: When you reach the border of what a
shell language can do, consider using better tools, more suitable
for the task you want to solve. For example, if you find yourself
in a while read something | cut | cut | sed | grep | sed | sort
piping chain, consider using awk. :-)

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

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