我写了一个小的bash程序,需要读取一个带有名字的文件input
.我希望脚本打印消息file not found
,如果找不到文件则退出或自行终止.
在阅读之前,检查文件是否存在:
if [ ! -f input ]; then
echo "File Not found"
exit 1
fi
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
241 次 |
最近记录: |