1.export command
The Linux Export command is used to set or display environment variables.
When executing a program in the shell, the shell provides a set of environment variables. Export can add, modify, or delete environment variables for use by subsequent executing programs. At the same time, it is important that the effect of export only extends to that landing operation. The environment variables given by the Export command do not exist, either by logging off or by opening a window again.
The syntax for this command is as follows:
Export [-fnp][variable name]=[variable setting value]
which
- -F represents the function name in [variable name].
- -n Deletes the specified variable. The variables are not actually deleted, but are not exported to the execution environment of the subsequent directives.
- -p lists all the environment variables that the shell assigns to the program.
You can view all current environment variables by typing export only. If you want to add some new paths (such as/bin/bash) to an environment variable (such as path), you can use the following command format
Export Path=/bin/bash: $PATH
2.bash command
Like the sh,bash,./command is used to execute shell scripts, the use cases are as follows:
[[email protected] bin] #bash filename[[email protected] bin]#sh filename[[email protected] bin]#. /filename
These three forms are used to open a child shell to read and execute the command in the filename. Another command interpreter is started when you run a shell script. Each shell script effectively runs in a child process of the parent shell. This parent shell refers to the process of giving you a command designator in a control terminal or in a xterm window. The shell script can also start his own child process. These child shells, or sub-processes, enable the script to run multiple subtasks within the script in parallel and efficiently. Slightly different: Under the bash/sh command, the filename file can have no "execute permission", that is, there is no X permission in the rwx. For the./command, the filename file must have Execute permissions.
3.source command
[[email protected] bin] #source filename[[email protected] bin]#. FileName
Function: Reads and executes the commands in the filename under the current bash environment. The filename file can have no execute permission. This command usually uses the command "." To replace.
the source (or point) command is typically used to re-execute a newly modified initialization document. The source command (from C Shell) is a built-in command of the bash shell. The point command is a dot symbol (from the Bourne shell). The program body of source is bash, and the value of the $ variable in the script is bash.
Export and Source,bash in shell scripts