Environment variable Path:
[Root@localhost ~]# set//check to see local and global Variables 2 kinds
[Root@localhost ~]# env//View the system's Global environment variables
[Root@localhost ~]# echo $PATH//View system environment variable path
[root@localhost ~]# Export $PATH//You can also use export to view environment variable paths
[root@localhost ~]# export path= $PATH:/date///Temporarily add/date directory to environment variable path
If you want to reboot the host, you have to edit the environment configuration file Root/.bashec or/root/.bash_profile and/etc/profile files, you want to take immediate effect you can use the command:
Note:. bash_profile file Detachment system Current user effective
[Root@localhost ~]# Source Bash_profile
[Root@localhost ~]# Ls–a can view these 2 files
Execution of scripts:
SH script//This method script does not require executable permissions
./script//must have executable permissions
. Script//This method script does not require executable permissions
Distinguishing between local and global variables
[Root@localhost ~]# str=1000//local variable
[Root@localhost ~]# Echo $str
1000
To edit a script:
# Vim Bianliang.sh
#!/bin/bash
Echo $str
[Root@localhost ~]# bianliang.sh//Our defined variables, but not the output through the script
[root@localhost ~]# Export str//Add to global variable
[Root@localhost ~]# bianliang.sh//Use full OK again
1000
To completely clear a global variable:
# unset STR Clears global variables
#env can view all global variables
&& | | Usage of: (Comparison of parameters)
The following action will be performed if the && condition meets the requirements
|| The following action is performed if the condition does not meet the requirements
See if there are any/grub.conf files in the/ect directory, output Yes, no output No.
[Root@localhost ~]# [-f/etc/grub.conf] && echo yes | | Echo No
Yes