当前位置:网站首页>The difference between single bracket and double bracket in shell

The difference between single bracket and double bracket in shell

2022-06-22 09:11:00 Commander in chief (commander in chief)

The difference between brackets and double brackets

Single bracket test The command is to perform word separation on variables , When the variable value contains a white space character , To enclose variables in quotation marks ; And double bracketed test The command does not word separate variables .

[[email protected] ~]# name="hello"
[[email protected] ~]# [ $name = "hello" ]
[[email protected] ~]# echo $?
0
[[email protected] ~]# [[ $name = "hello" ]]
[[email protected] ~]
原网站

版权声明
本文为[Commander in chief (commander in chief)]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206220904060507.html