1. Variables
[
For the shell, the values of all variables are characters, and the shell program uses
--永久:在/etc/profile 中添加export 变量名=变量值
【注:1.export:用此定义后可以在所有命令或程序中都可以访问到
2.定义完变量后 source /etc/profile才能使用】
d. Define environment variables:
– Temporary: export variable name = variable value
e. Clear environment variables: unset
$$: Current process number
$0: Current process name
g. Variable expression
– string comparison;
– digital comparison: -eq equal
-ne not equal
-ge greater than or equal/greater than equal /
-le is less than or equal to /less than equal/
-gt is greater than
-lt is less than
! non
-logical test: -! Opposite of a logical value
- a (and) is true only if both are true
- o (or) is true if one is true
- file operations: -d: object exists and is a directory
-f: object exists and is a file
-rwx : The object exists and is readable, writable, and executable
Second, the shell program establishment, debugging, execution
[The shell program contains:
Beginning: #! /bin/bash [! Indicates that the shell is running! The following commands use the rest of the document as input];
Comments: #filename:~;
statement execution part;]
1. Build: touch to create a file >> vi edit content >> chmod u+x /chmod 744 (change the file to readable Execute)
2. Debug: bash -evx [absolute path to the shell program file]
[-e Exit if there is a command error
-v Both the original command line and the replacement content are displayed
-x The original command line has + at the beginning of the line]
3. Execute: [ Three kinds]
a.bash [absolute path of shell program file] [calling the new bash command interpreter, passing the file as a parameter]
b.bash<[absolute path of shell program file] (input redirection)
c. file absolute path
[ Note: The general number sequence is: a is easy to use for debugging c]
three,
1.ls -t view in chronological order
2.pwd view the current directory
3.expr expression (manual command line counter)
spaces separate special symbols with / escape quotation marks