当前位置:网站首页>String test operator of shell command

String test operator of shell command

2020-12-07 11:03:30 osc_ 35cfk3ig

Common string test operators :

-z " character string " If the string length is 0 It is true ,-z It can be understood as zero
-n " character string " If the string length is not 0 It is true ,-n It can be understood as no zero
" strand 1" = " strand 2" Ruoshan 1 Equal to string 2 It is true ,= have access to == replace
" strand 1" != " strand 2"


Be careful :
(1.) The string must use "" Lead up
(2.) There must be spaces on both sides of the comparison symbol
The above notes are a kind of norm , Most of the time, no spaces and " All right , But there are special circumstances , The following is a special case , So it's still recommended to abide by .
shell Order   String test operator



give an example :
shell Order   String test operator

shell Order   String test operator

版权声明
本文为[osc_ 35cfk3ig]所创,转载请带上原文链接,感谢
https://chowdera.com/2020/12/20201207105953092q.html