I'm writing a "for loo" statement that checks a test file to see if the mutiple entered arguments exists. The script I have written just returns the everything as if it exists even if it doesn't
for i in "$@"
do
grep -q "$i" /home/s132a18/A10/cisStudents && echo "$i is a student" || echo "$i is not a student"
done
When the word not
is the only difference:
for i in "$@"
do
echo "$i is $(grep -q "$i" /home/s132a18/A10/cisStudents || echo "not ")a student"
done
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.