基本操作符
-s: Check if file has size greater than 0 if yes then condition becomes true.
实际应用中,[ -s $file ] 如果$file内容不为空,或者file其实是个folder的话,都返回true
ksh -n
-n Read commands and check them for syntax errors, but do not execute them. Ignored for
interactive shells.
interactive shells.
会检查语法中的错误,比如文件中引号是否成对出现等
True, if file exists and is a symbolic link.如果文件存在并且是是个符号链接。返回true。
-d file
True, if file exists and is a directory. 文件存在并且是目录,返回true
常见符号
$$ 记录脚本运行是的pid,进程号