![if [-f file]; 是什麼意思?意思是?](https://rvso.com/image/1416875/if%20%5B-f%20file%5D%3B%20%E6%98%AF%E4%BB%80%E9%BA%BC%E6%84%8F%E6%80%9D%EF%BC%9F%E6%84%8F%E6%80%9D%E6%98%AF%EF%BC%9F.png)
我在 bash 檔案中有一個 if 語句:
if [ -f bin/post_compile ]; then
echo "-----> Running post-compile hook"
chmod +x bin/post_compile
sub-env bin/post_compile
fi
是什麼-f
意思?
答案1
如果該文件存在且是常規文件。
http://www.tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html
你的英文陳述:
如果文件「/bin/post_compile」存在且是常規文件,則:
- 列印訊息
- 使檔案可執行
- 使用執行檔
sub-env
萬一 (fi
)