利用 bash 檢查檔案是否存

在 Linux 中,可以透過  bash  script 檢查檔案是否存在,範例如下:

if [ -f testfile ]
then
echo testfile exists!
fi


 資料來源:Determine if file exists in a Bourne/bash shell script - Tech-Recipes.com

留言

這個網誌中的熱門文章

在 Chromebook 上使用嘸蝦米輸入法簡介

修復 Thunderbird 壓實重整造成的信件內容異常

在 scim 中安裝嘸蝦米:由行易公司提供的 cin 檔