Linux и UNIX: программирование в shell. Руководство разработчика - Страница 108
fi
# отображение имени метода и кодированной строки
echo "Method : $REQUEST_METHOD"
echo "Query String : $QUERY_STRING"
echo "
"
# используется sed для замены & символом табуляции
LINE=`echo $QUERY_STRING | sed 's/&/ /g' `
for LOOP in $LINE
do
NAME=`echo $LOOP | sed 's/=/ /g' | awk '{print $1}'`
TYPE=`echo $LOOP | sed 's/=/ /g' | awk '{print $2}' |
sed -e 's/%()/\x/g' | sed 's/+/ /g'`
# используется printf для преобразования шестнадцатеричных символов
printf "$=$n"
VARS=`printf "$=\$n"`
eval `printf $VARS`
done
echo "
"
if [ "$contact" != "" ]; then
printf "Hello $contact, it's great to meet youn"
else
printf "You did not give me your name… no comment !n"
fi
if [ "$film" != " — Pick a Film —" ]; then
printf "Hey I agree, $FILM is great filmn"
else
printf "You didn't pick a filmn"
fi
if i "$actor" != " —- Pick Your Favourite Actor --" ]; then
printf "So you like the actor $actor, good calln"
else
printf "You didn't pick a actor from the menun"
fi
if [ "$view_cine"="on" ]; then
printf "Yes, I agree the cinema ls still the best place to watch a filmn" else
printf "So you don't go to the cinema, do you know what you're missingn" fi
if [ "$view_vid"="on" ]; then
printf "I like watching videos at home as welln"
else
printf "No video!!. you're missing out on all the classics to rent or buyn'
fi
if [ "$textarea" != "" ]; then
printf " And here are your comments…OK $textarean"
else
printf "No comments entered, so no comment !n"
fi
echo ""
echo "