qfedu-linux-advanced-level/day1/d20.sh

16 lines
359 B
Bash

#!/bin/bash
# 多重条件判定:
# 1. -a 是与
# 2. -o 是或
# 3. ! 是非
#!/bin/bash
# 检查文件是否存在并且可读可写可执行
if [ -e "$1" ] && [ -r "$1" -a -w "$1" -a -x "$1" ]; then
echo "file $1 exists and is readable, writable, and executable"
else
echo "file $1 does not exist or is not readable, writable, or executable"
fi