shell脚本检测文件是否存在
时间:2015-01-14 12:53 来源:linux.it.net.cn 作者:IT
一例shell脚本,用于检测文件是否存在,shell中-f参数检测指定文件存在与否。
例子,shell脚本 检查文件是否存在。
#!/bin/bash
#
FILE="/etc/hosts"
if [ -f $FILE ]; then
echo "File ${FILE} exists"
else
echo "File ${FILE} does NOT exists"
fi
(责任编辑:IT)
一例shell脚本,用于检测文件是否存在,shell中-f参数检测指定文件存在与否。
例子,shell脚本 检查文件是否存在。
#!/bin/bash
FILE="/etc/hosts" (责任编辑:IT) |