tsrrhhh tsrrhhh - 9 months ago 40
Bash Question

Reason why a shell command behave differently depending on OS


, there are shell command (or should I say it script language?) which don't behave in the same way in the same shell. Behavior of them seems to be different depending on OS (BSD or GNU) not on shell though they are shell command. I wonder at this. Could anyone give me a plain explanation ?


Different systems evolved their own tools and syntax, to a certain degree. Linux uses the GNU toolchain, which supports a variety of modern options. However, there is one thing that Linux and BSD (and many other Operating Systems) have in common: POSIX.

This is the POSIX specification for sed. You can rely on these working on all *nix platforms. There is usually a way to do whatever you're trying to do in a way that works with all versions of sed.

You'll also find the same inconsistencies between awk and gawk.