我正在编写“ for loo”语句,该语句检查测试文件以查看是否输入了多个参数。我编写的脚本会返回所有内容,即使它不存在
for i in "$@"
do
grep -q "$i" /home/s132a18/A10/cisStudents && echo "$i is a student" || echo "$i is not a student"
done
答案 0 :(得分:0)
当单词not
是唯一的区别时:
for i in "$@"
do
echo "$i is $(grep -q "$i" /home/s132a18/A10/cisStudents || echo "not ")a student"
done