可以使用如下命令判断变量 blackIpList 对应的文件是否存在,如果不存在则创建: if [ ! -f "$blackIpList" ]; then touch "$blackIpList" fi