If your shell script is just sequentially calling other commands, any shell interpreter will run it with the same result. Nothing unexpected here. This isn't related to the question, but what exactly is the difference between bash and dash?
Both are using the Bourne shell syntax. On the other hand, bash is a shell with quite a large number of extensions and non standard features, some inspired by ksh , ksh93 and other shells, and some bash specific, known as bashisms.
There is a tool named checkbashisms that helps identifying everything that is not strictly portable in a given shell script. Community Bot 1. Sign up or log in Sign up using Google. Sign up using Facebook.
Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Explaining the semiconductor shortage, and how it might end. Does ES6 make JavaScript frameworks obsolete? If you run your script with bash scriptname , or run it with scriptname and have! So, how do they actually differ? The Bash Reference manual has a section which attempts to enumerate the differences but some common sources of confusion include [[ is not available in sh only [ which is more clunky and limited.
See also Difference between single and double square brackets in Bash sh does not have arrays. Some Bash keywords like local , source , function , shopt , let , declare , and select are not portable to sh. Some sh implementations support e. Bash has significantly extended facilities for shell arithmetic though still no floating-point support. Several built-in commands have options which are not portable, like type -a , printf -v , and the perennial echo -e.
Many, many Bash-only extensions to enable or disable optional behavior and expose internal state of the shell. Many, many convenience features for interactive use which however do not affect script behavior. Perhaps it's not available in some ancient shells, but it's definitely not a bashism. Analogy: Shell is like an interface or specifications or API.
Bash is a subclass of the sh. Premraj Premraj I don't get it. You've mentioned both "Bash is superset of sh" and "Bash is a subclass of the sh", aren't they contrary statements? Can you please clarify? I think this is trying to say Bash inherits from sh so it's a "subclass" in the OOP sense and extends it so has a superset of the functionality. Shell is not the same with sh? Post from UNIX. COM Shell features This table below lists most features that I think would make you choose one shell over another.
Y Feature can be done using this shell. N Feature is not present in the shell. F Feature can only be done by using the shells function mechanism. L The readline library must be linked into the shell to enable this Feature.
Notes to the table above This feature was not in the original version, but has since become almost standard. This feature is fairly new and so is often not found on many versions of the shell, it is gradually making its way into standard distribution. The Vi emulation of this shell is thought by many to be incomplete. This feature is not standard but unofficial patches exist to perform this. This can be done via the shells programmable completion mechanism.
Only by specifying a file via the ENV environment variable. SriniV SriniV Your table is not useful to me as it tries to compare features of the Bourne Shell and features from ksh from before If you really make a table for , you would need to remove most of the other shells from that table - including bash, sh and rc.
Could you explain where did yo get the values for your table from? The Korn shell has process substitution since at least and it is OpenSource since Based on what schily exposed it would seem that it would be better to remove this answer, as it is essentially fraudulent, and OP didn't really vet the information he pasted. Show 4 more comments. SHELL Is a program that runs in the terminal Shell is both a command interpreter and a programming language Shell is simply a macro processor that executes commands.
Macro processor means functionality where text and symbols are expanded to create larger expressions. SH Vs. Timothy L. Stewart Timothy L. Stewart 1, 14 14 silver badges 13 13 bronze badges. Andrzej Pronobis Andrzej Pronobis This is basically what my answer as of just now really boils down to. Ryan Taylor Ryan Taylor These days, you would hope that any sh you find is at least POSIX-compatible; but on legacy systems this is by no means a given.
POSIX stadardizes far more than the shell; in fact, you could argue that the standardization of operating system calls and library functions is more important. There are obviously corner cases like when a script uses a variable whose name is reserved by Bash but not by other shells. Keith Thompson Keith Thompson k 39 39 gold badges silver badges bronze badges. The differences explained in the easiest way possible: After having a basic understanding, the other answers will be easier to understand.
Thus, bash is a command processor. Also, bash is one implementation of sh. Sh is not really a programming language, but a specification. On the other hand, when the sh command is used in a bash script, it creates a contained environment context for a "command" to run. The Overflow Blog. Podcast Explaining the semiconductor shortage, and how it might end. Does ES6 make JavaScript frameworks obsolete?
Featured on Meta. Now live: A fully responsive profile. Linked Related Hot Network Questions. Question feed. Super User works best with JavaScript enabled. Accept all cookies Customize settings.
0コメント