Shell Programming:
Compiler: Also called interpreter
The shell provides us with another feature:
Programming language: Turning human language into a machine-understandable language
Machine language (01 code), assembly language (still very low, growth cycle is longer, learning is more difficult)
High-level language (however, it is not a human language, but the closest to human language)
Static language:
Compiled language (there is a program development environment, do not need to use the additional binary program, write code directly, after the completion of the need for a compiler, put the code into the compiler can be given to the hardware to form a separate running program, we call him static language)
Convert to executable format in advance
One of the important characteristics required: Strong type (variable)
Key words:
Complete conversion before execution, prior to conversion to executable format program
Like c,c++,java,c# (no interpreter needed, self can run)
Dynamic language: Interpreted language on the fly
(a code after our programmer has finished writing, he does not need to convert to binary format, but there is an interpreter, explain a, execute one, that is, after the execution of the conversion)
(usually) weak type: Edge interpretation Side Execution
Like Php,shell,python (very popular, object-oriented, many game scripts are used in Python), Perl (earlier popular: pronunciation: po (broken))
BASH: The easiest to learn and the easiest to get started with is the shell
If you can learn Python is more powerful, add a lot of wings.
Perl process-oriented, although perl6 with objects, but now for a variety of reasons also not popular
In fact, a lot of scripts are developed in Python, in the study of computers for many years, have not learned python, so school is disjointed.
Process-oriented: relatively small application development: Shell,c
The focus of programming is mainly on the process of problem solving itself.
Object-oriented: relatively large application development: JAVA (Object-oriented language only), Python (object-oriented language only), perl,c++
Meaning: The entire project we want to implement is abstracted from one object to another, and defines the action between objects, which is what can be done, so this is more suitable for developing large programs
But any tool is a double-edged sword (a chopper can kill or cut a dish)
To understand programming, you have to understand variables
Variable (changing amount): Is the memory space, the name of the content space (is the amount of change, stored in a memory of the storage space, according to the address can find this)
Memory is the storage unit that is stored
We correspond to variables and memory addresses, so what we see is a variable, like a, which corresponds to a memory address space.
What is a script?
How to write a script: In fact, is the order of the stack, according to the actual needs, combined with the command flow control mechanism to implement the source program script.
Linux can only recognize the ELF format to execute (that is, the first line of the script must be #!/bin/bash,bash is the interpreter,/bin/bash is the interpreter path), so that an ASCII-formatted text can be executed
Almost all of our files are in Aciss format.
So we want to run the script file, must be in the first line of the file with
#!/bin/bash
(and then the # that comes up is the note # (that is, as an effective component)
So once the file is executed, it will read the first line, and it will run with the Bash editor.
And know that the shell script file is going to use the. sh suffix, just like a local warehouse to use. Repo.
0. What is a variable and what is Shell programming