Shell scripts are usually text files that start with #!/bin/bash. #! is placed before the interpreter path.
Use bash as the interpreter to interpret all command-line commands.
There are two ways to run a script, one is to use the script as a command-line argument for SH, and the other is to use the script as an executable file with enforceable permissions. Run the script as a command-line argument as follows:
SH aa.sh: Assume that the script file is under the current path. Otherwise write full path execution. You can also execute scripts chmod a+x aa.sh./aa.sh by modifying the permissions of the script file.
Use # in the script to represent comments.
Terminal printing:
Echo is the basic command for terminal printing. echo "Hello" if there is a special character need to use the transfer character ' \ '.
printf can also be used for printing, as in C. printf "Hello"
Variables and Environment variables:
You can use the ENV command to view all environment variables associated with this terminal process at the terminal, which is used by the Export command to set environment variables.
Linux Shell Script Raiders 001