#!/bin/bash
echo -n "Is it morning? please input yes or no: "
read yesorno
if "$yesorno" = y*
then
echo "Good morning"
elif [ "$yesorno" = "no" ] || [ "$yesorno" = "NO" ]
then
echo "Good afternoon"
else
echo "wrong input"
fi
exit 02.
#!/bin/bash
rm -f myFile.txt
if [ -f myFile.txt ]; then
:
else
echo "myFile.txt does not exist!"
fi
exit 0
本文介绍了使用bash脚本进行文件操作的基本技巧,包括如何通过条件判断实现文件存在的检查及相应的输出。
468





