我有一个 shell 脚本,需要你的专业知识。
SearchAirline() {
echo "Enter Airline Name:"
read airlineName
if [ $? -eq 0 ];then
echo -e "\t\t\E[43;31;1mFlight Information\E[0m"
echo -e "Departure Time Flight Airlines Vacancy"
echo "__________________________________________________________________________"
#cat flightlist.txt | grep $airlineName flightlist.txt
old_IFS=$IFS
IFS=$'\n'
for LINE in `sed -e '$airlineName' flightlist.txt`
do
print_flight $LINE
done
IFS=$old_IFS
fi
}
给我过滤列表是行不通的。相反,它会打印整个列表。