Shell错误[: missing `]' shell 文件运行时出现错误: [: missing `]' 原因可能是 if [ ! -d $date] then mkdir ./$date fi 代码中的 ] 方括号内部必须要有个空格,if [ ! -d $date] 改成 if [ ! -d $date ] 即可