This note is based on the linuxShell programming entry to the proficient book study experiment and related finishing notes
pdf file download: http://download.csdn.net/detail/ruishenh/6586391
Chapter 1 Concepts
1. Use a file with executable permissions to run the file directly.
2. Directly invoke the command interpreter to execute the program
3. Use the source to execute the file
1. The built-in command is the command of the shell program itself. These commands are integrated into the shell interpreter. For example (cd)
2. Shell functions are a series of program code written in shell language that can be referenced like other commands.
3. An external command is an executable program that is independent of the shell. For example, find, grep, echo.sh. When the command line shell executes an external command, it creates a copy process of the current shell to execute. During the execution process, there is a process of creation and demise. The execution of external commands is as follows.
1 Use the POSIX system fork function interface to create a copy of the command line shell process (child process).
2 In the running environment of the child process, find the location of the external command in the Linux file system. If the external command gives the full path, skip this step.
3 In the child process, replace the shell copy with a new program and execute (exec), at this time the parent process goes to sleep, waiting for the child process to complete.
After the execution of the child process, the parent process then reads the next command from the terminal.
Note
(1) The child process is exactly the same as the parent process at the beginning of the creation, but the child process cannot change the parameters of the parent process.
(2) Only the built-in commands can change the property of the command line shell (environment variable).
When using shell to execute shell scripts, subprocesses are not created, but executed directly in the parent process!
Variables are defined in many programming languages, with definitions of scope of use associated with variables. The essence of a variable is a key-value pair (key=value)
The name of a shell variable begins with a letter or an underscore, followed by a apostrophe, number, or underscore of any length. Unlike many other programming languages, shell variable name characters do not have a length limit. The Linux Shell does not distinguish between types of variables. All values are strings, and like variable names, values do not have a character length limit. The magic is that bash also allows comparison operations and integer operations. The key reason is whether the string value in the variable is a number.
Variable types: local variables and global variables.
Local variables must be specified with the local display when declaring. Global variables do not need to be modified. (environment variable)
Echo output
$ echo 'abc'$ echo $JAVA_HOMEExport import variable
exportPATH=/usr/local/pig/pig- 0.12.0/bin: $PATHThe env function and the set function are different env functions that display environment variables, and the set function displays all local variables, including the user's environment variables. For example, when the user sets 笠Var=123 on the command line, the set function will display the var variable, while the Env function will not show
(var is now a local changer, not an environment variable). If you use the export var = 123 command, both the set and Env functions can display the var variable.
Language Types
Computers cannot directly understand high-level languages. They can only understand machine language directly, so you must translate high-level languages into machine-language computers to execute programs written in high-level languages.
Languages are generally divided into compiled and interpreted
Compiled languages have exe files such as those used. binary file. Or the .class file (jar file) of the java program
The interpreted type has js, python, shell, etc.
Linuxshell Advantages
1. Concise
The kernel environment in which the Linux Shell is located makes any advanced operations possible.
2. Easy to develop Because it follows the philosophy of Unix, optimized to today, it is easy to develop under the accumulation of predecessors
3. Easy to transplant
Run on any unix/linux
Add ## to the shell script to introduce the
#!/bin/bash #!/bin/Sh#!/bin/rm#!/bin/more
Basic minimalist directory file after successful production First, the basic boot process of the s
Yesterday I received the zabbix alarm email, the usage rate of a servers /home directory re
caused by Linux clone virtual machine The virtual machine Vmware cloned a Red Hat Enterpris
Understand the process: ? PID, PPID? Current process status? Memory allocation? CPU and actu
Windows 8 fast shutdown method and skills
Retrieve lost Windows XP Firewall
Two modes of Windows 8 System Task Manager
Check out the eight features of Microsoft's next-generation system Windows 10
Linux programming common problems Daquan
What is the Win7 screenshot shortcut? How to set Win7 screenshot shortcuts?
Flexible and easy to use Win8.1 Update commonly used shortcuts Daquan
Win7 system mouse right click menu background picture how to set?
How does the entire interface of the Win10 system turn black?