shell 之 -f -z -e -o -a -d

# -f 文件存在
if[ -f /etc/sysconfig/network ]; then 
	./etc/sysconfig/network
fi

# -z 字串为空/ -o or / -a and
if[ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" ]; then 
	HOSTNAME=localhost
fi

# !
if [ ! -e /proc/mounts ]; then
	mount -n -t proc /proc /proc
fi


# -d 目录存在
if [ ! -d /proc/bus/usb ]; then
	modprobe usbcore >/dev/null 2>&1
else
	mount ...
fi

猜你喜欢

转载自niewj.iteye.com/blog/2312370