1, determine if the folder existsif[-d/home/q/www];then Echo"true";ElseEcho"false"; Fi (folder exists in the system/home/q/www)2, determine whether the file existsif[-E/ETC/PASSWD];then Echo"true";ElseEcho"false"; Fiif[-F/ETC/PASSWD];then Echo"true";ElseEcho"false"; fi file exists and size greater than 0if[-S/ETC/PASSWD];then Echo"true";ElseEcho"false"; Fi3, judge the document to be readableif[-R/ETC/PASSWD];then Echo"true";ElseEcho"false"; Fi4, judgment file can be writtenif[-W/ETC/PASSWD];then Echo"true";ElseEcho"false"; Fi5, judging file executableif[-X/ETC/PASSWD];then Echo"true";ElseEcho"false"; Fi6, string length is 0, return true length is 0if[-Z""];then Echo"true";ElseEcho"false"; fi length is not 0if[-Z"Xiaoqiang"];then Echo"true";ElseEcho"false"; Fi7, string length is not 0, return true length not 0if[-N"Xiaoqiang"];then Echo"true";ElseEcho"false"; Fi length is 0if[-N""];then Echo"true";ElseEcho"false"; Fi8, judging the string equalityif["Xiaoqiang"="Xiaoqiang"];then Echo"true";ElseEcho"false"; Fi9, judge the string is not equalif["Xiaoqiang"!="Xiaoqiang"];then Echo"true";ElseEcho"false"; FiTen, judging the equality of integersif[1-eq1];then Echo"true";ElseEcho"false"; Fi One, judging that integers are not equalif[1-ne1];then Echo"true";ElseEcho"false"; Fi A, judging integers1<2if[1-lt2];then Echo"true";ElseEcho"false"; Fi -, judging integers2<=2if[2-le2];then Echo"true";ElseEcho"false"; Fi -, judging integers 3 >2if[3-gt2];then Echo"true";ElseEcho"false"; Fi the, judging integers3>=3if[3-ge3];then Echo"true";ElseEcho"false"; Fi -, logical operation! (non)if[ !3-ge3];then Echo"true";ElseEcho"false"; Fi-A (and)if[-Z""-A3-ge3];then Echo"true";ElseEcho"false"; Fi-O (OR)if[-Z"SADFSA"-O3-ge3];then Echo"true";ElseEcho"false"; Fi -, special variable echo"number:$#"get the number of parameters echo"scname:$0"get the script name Echo"first:$1"gets the first parameter of Echo"second:$2"get the second parameter echo"Argume:[email protected]"get all parameters echo"show Parm list: $*"Listecho of data parameters"Show Process ID: $$"Get Process Idecho"show Precomm stat:$?"Gets the result of the command execution
Shell Common Criteria for judging