So, there are many types of shells in Linux...

Different Types of Shells in Linux

The Bourne Shell (sh) ...
The GNU Bourne-Again Shell (bash) ...
The C Shell (csh) ...
The Korn Shell (ksh) ...
The Z Shell (zsh)

I have a project where I have to put together a script for the Bourne shell, starting with shebang #!/bin/sh.

But whenever I use Google to learn about some detail, I always get tons of results for bash, which I suspect are ok to use with sh, but not always...

So I want to tell Google, "No! Give just stuff for the original Bourne shell!". But people don't type the string "Bourne shell" into most of their web pages, so Google can't help me directly with that.

Adding "sh" to my search query doesn't help much, it matches .sh file extensions, and it matches bash!

Adding "#!/bin/sh" to my search query is somewhat helpful - but I will see only results in scripts, when sometimes the simple anwsers are presented as terminal commands (which we can then adapt for use in scripts).

I know there won't be any "silver bullet" perfect solution, but in a spirit of "tips and tricks", would any of you suggest clever ways to narrow down my results like I intend?

Or is the only solution to use a handful of authoritative Bourne shell documentation sources? If so, which ones?

  • 3
    Is this a question about how to use Google Search?
    – Kusalananda
    May 22, 2021 at 10:14
  • They're probably asking how to search/get result for a specific shells, and maybe confuse that some shells's code have compatibility between each other or/and can be adapted to another. @Kusalananda May 22, 2021 at 10:26
  • 1
    @NordineLotfi Well, the manual for the sh shell on any given system is readily available with man sh.
    – Kusalananda
    May 22, 2021 at 10:41
  • Indeed :) That's what your and my answer explained too. (I already know you know this but was more of an answer to OP) @Kusalananda May 22, 2021 at 10:42
  • 3
    I’m voting to close this question because this is about using search engines, not Unix.
    – Barmar
    May 22, 2021 at 22:11

4 Answers 4


You most likely aren't actually interested in the historical Bourne shell (which is not commonly available on most current UNIX systems), but in shells that implement the current POSIX specification for the sh shell.

See also:

  • The currently accepted answer to the U&L question What does it mean to be "sh compatible"? goes into great detail describing the history and "pedigree" of Unix shells.

  • The command man sh on the system you are working with will show you the manual for the sh shell on that system. This will be a shell implementing the POSIX syntax and grammar, possibly by changing the way the shell would normally behave if invoked using its own name (like bash and zsh does when invoked as sh, for example).


In my experience, if you're looking for help about how to do a given thing using your #!/bin/sh shell you could prepend your Google query with one of the following:

  • POSIX - it will lead you to discussion about implementing a given feature in POSIX-compatible shells or in POSIX-compatible manner in shells that implement more functions that are not required by POSIX such as Bash. (usually you'll end up at https://unix.stackexchange.com)

  • dash - dash is /bin/sh Ubuntu which is the most popular desktop Linux distro. It's used by cron and other tool that run commands using /bin/sh so many questions have been asked and answered

  • busybox - busybox comes with its own shell which is not as huge as Bash or ZSH so if something works in busybox shell it should also work with your local minimalist /bin/sh, whatever it is.


Here something that I would say is the best way to tackle this:


Now while this may sounds obvious or rude, you may ask "what commonsense?":

  • bash is sometimes symlinked to sh on certain distros
  • sh is sometimes symlink to ash (busybox)
  • bash script usually work fine (except for certain syntaxes) under sh, and vice versa (same for ash-sh)
  • Try them. (literally, as it probably wouldn't be obvious that whatever snippet have errors or not, unless you use shellcheck or have more experience)
  • Try different keywords combination (this is obvious but harder to explain in details without making this post longer)
  • Try different search engine (most have similar result, but not always, if ever exact same result, with the same keywords)

You can apply/expand the above for other shells too. Just don't hesitate to try whatever snippet/code you find (I find -x or set -x for debugging and shellcheck to be useful help when doing that).

Of course, it is still recommended to use the related documentation for each shells when you're in doubt or stumble on problems.

Additional resources:

Trying is part of learning. Good luck!


Of the common Linux distributions, I think most (e.g. CentOS and Arch) use Bash as /bin/sh. The main exception is with Debian and Ubuntu (and derivatives), which use Dash. Ubuntu also has a helpful wiki page identifying the most common "Bashisms": https://wiki.ubuntu.com/DashAsBinSh

Note that the original Bourne shell is slightly different from the POSIX shell that e.g. Dash implements. You're not going to find that on Linux systems without explicitly looking for it, e.g. the Heirloom Shell.

  • The heirloom is a buggy port of the original Bourne Shell that introduces deviations you are not interested in if you are interested in the historic behavior. If you like a clean port of the original Bourne Shell, have a look at obosh from the schilytools.
    – schily
    May 23, 2021 at 20:56

Not the answer you're looking for? Browse other questions tagged .