#前言
用 bash 來確認檔案存不存在
範例
FILE=test.sh
if [ -f "$FILE" ]; then
echo "$FILE exists."
else
echo "$FILE not exists."
fi
結果
依照檔案存不存在會有不一樣的結果。
#前言
用 bash 來確認檔案存不存在
FILE=test.sh
if [ -f "$FILE" ]; then
echo "$FILE exists."
else
echo "$FILE not exists."
fi
依照檔案存不存在會有不一樣的結果。