Linux_Shell_学习笔记_20150604(5)
时间:2025-02-21
时间:2025-02-21
Shell编程复习
done
5 条件语句
shell里的条件语句主要是if语句、case语句
5.1 if语句
5.1.1 结构
if 表达式
then
[command]
elif 表达式
then
[command]
else
[command]
fi
5.1.2 举例
if test file1 -nt file2
then
echo "file1 is newer"
elif test file1 -ot file2
then
echo "file1 is older"
else
echo "file1 is as new as file2"
fi
上一篇:人教版七年级上期中地理测试卷