What is bin sh in shell script




















Please let me know whether it is considered in the script or not as it is commented. The sha-bang! Immediately following the sha-bang is a path name. This is the path to the program that interprets the commands in the script, whether it be a shell, a programming language, or a utility.

This command interpreter then executes the commands in the script, starting at the top the line following the sha-bang line , and ignoring comments.

Its name, bash is an abbreviation of Bourne-Again Shell, an homage to the Bourne shell it was designed to replace, though it also incorporates features from the C Shell and the Korn Shell. It's not just users that use shells, though. Scripts shell scripts need shells to interpret them. When you run a shell script, your system needs to start up a shell process to execute your script.

The problem is, different shells have tiny little inconsistencies between them, and when it comes to running scripts, these can be a real problem. This is fine, if you're always going to use bash to run those scripts.

Other shells may try to either emulate bash, or adhere to the POSIX standard, which bash supports pretty well though adds its own extensions to. It's possible to specify at the top of a shell script which shell it should be run with using a shebang.

A script may specify! Actually, it is usually implemented as a symbolic link pointing to the executable for whichever shell is the system shell. The system shell is kind of the default shell that system scripts should use.

Dash is seen as a lighter, and much faster, shell which can be beneficial to boot speed and other things that require a lot of shell scripts, like package installation scripts. However, it doesn't implement the bash-specific extensions. There are scripts in existence that use! Even though Ubuntu's system shell is pointing to dash, your login shell as a user continues to be bash at this time. That is, when you log in to a terminal emulator anywhere in Linux, your login shell will be bash. Speed of operation is not so much a problem when the shell is used interactively, and users are familiar with bash and may have bash-specific customisations in their home directory.

Ubuntu Community Ask! Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group.

Create a free Team What is Teams? Learn more. As you progress through this book, you will learn how to manipulate commands with the shell. One of the best things about the shell is that if you make a mistake, you can look at what you typed, see what went wrong, and then try again quickly.

Do not be afraid to try new things. The only way to learn the shell is to use it. Every Unix system needs the Bourne shell to function correctly, as you will see throughout this book. Linux uses an enhanced version of this shell, called bash , or the "Bourne-again" shell. You should use the bash shell when running the examples in this book. You may not have bash if you're using this chapter as a guide for a Unix account at an organization where you are not the systems administrator.

You can change your shell with chsh or ask your systems administrator for help. Toggle navigation. See also. Home Linux systems How linux works. Remember the name: eTutorials.



0コメント

  • 1000 / 1000