-
[[]] In the action script in one extension to match a regular expression [[= ~]] For example:
[root@localhost data]# touch f1.sh
[root@localhost data]# file=f1.sh ;[[ $file =~ \.sh$ ]]
[root@localhost data]# echo $?
0
[root@localhost data]# file=f1.shsh ;[[ $file =~ \.sh$ ]]
[root@localhost data]# echo $?
1 -
[[]] Role in the script is to match the two wildcard Usage: [[==]] or [[=]!] For example:
[root@localhost script]# file=f1.shsh
[root@localhost script]# [[ "$file" == f ]]
[root@localhost script]# echo $?
0
[root@localhost script]# [[ "$file" == fx ]]
[root@localhost script]# echo $?
1 - echo $ _ represents the last parameter of a command.
- Shell scripts () action to the inside of the sub-shell command execution inside, quit after finished
[root@localhost script]# ( u=1;sleep 1000 )
See FIG Process
In contrast {;} is only performed in the current shell.