[[ -e file ]] && echo "file exits" || touch file
怎么样判断文件是否存在
博客内容展示了一段Shell脚本,通过`[[ -e file ]] && echo \file exits\ || touch file`来判断文件是否存在。若文件存在则输出提示信息,若不存在则创建该文件,体现了Shell脚本在文件操作方面的应用。
博客内容展示了一段Shell脚本,通过`[[ -e file ]] && echo \file exits\ || touch file`来判断文件是否存在。若文件存在则输出提示信息,若不存在则创建该文件,体现了Shell脚本在文件操作方面的应用。
[[ -e file ]] && echo "file exits" || touch file

被折叠的 条评论
为什么被折叠?