Variable testing of shell programming

a test expression
Complex format, simple logic
Variable tests are used when variables are optimized


 
 
Two actual combat
[root@localhost ~]# unset y
[root@localhost ~]# x=${y-2}
[root@localhost ~]# echo $x
2
[root@localhost ~]# y=""
[root@localhost ~]# x=${y-2}
[root@localhost ~]# echo $x
 
[root@localhost ~]# y=1
[root@localhost ~]# x=${y-2}
[root@localhost ~]# echo $x
1

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326151897&siteId=291194637