Shell Programming - Getting Started

1. What is a shell?

The shell is both a command language and a programming language.

The shell program is a program written in C language, which is a bridge for users to use linux. This application provides an interface through which the user accesses the services of the operating system kernel.

2. What is a shell script?

A shell script is a scripting language written for the shell.

The usual shell usually refers to the shell script, but you must know that the shell and the shell script are two different concepts.

3. Shell environment
Shell programming is the same as java and php programming, as long as there is a text editor that can write code and a script interpreter that can interpret and execute.
There are many kinds of shell script interpreters in Linux, the common ones are:
    Bourne Shell (/usr/bin/sh or /bin/sh)
    Bourne Again Shell (/bin/bash)
    C Shell (/usr/bin/csh)
    K Shell ( /usr/bin/ksh)
    Shell for Root (/sbin/sh)
    ...
Bash is widely used in daily work due to its ease of use and free, aka Bourne Again Shell. At the same time, Bash is also the default shell of most Linux systems.
In general, people don't distinguish between Bourne Shell and Bourne Again Shell, so, like #!/bin/sh, it can also be changed to #!/bin/bash.
#! tells the system that the program specified by the following path is the shell interpreter that interprets the script file (a shell interpreter is also a shell program).

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324688516&siteId=291194637