mur*_*uru 35
你不需要检查它是否存在,检查读写权限就足够了:
来自help test,精选的相关测试:
-a FILE True if file exists.
-e FILE True if file exists.
-f FILE True if file exists and is a regular file.
-r FILE True if file is readable by you.
-s FILE True if file exists and is not empty.
-w FILE True if the file is writable by you.
Run Code Online (Sandbox Code Playgroud)
所以你可以试试:
-a FILE True if file exists.
-e FILE True if file exists.
-f FILE True if file exists and is a regular file.
-r FILE True if file is readable by you.
-s FILE True if file exists and is not empty.
-w FILE True if the file is writable by you.
Run Code Online (Sandbox Code Playgroud)