cgi调用bash:解析http get请求的参数

!/bin/bash --login

shopt -s expand_aliases
source /etc/shareprofile.txt
echo "Content-Type:text/html"
echo ""
ID=echo "$QUERY_STRING" | grep -oE "(^|[?&])id=[0-9]+" | cut -f 2 -d "=" | head -n1
MODE=echo "$QUERY_STRING" | grep -oE "(^|[?&])mode=[^&]+" | sed "s/%20/ /g" | cut -f 2 -d "="
echo "changing campid : $ID using mode : $MODE"
echo "

"
setmode $ID $MODE
echo "

"
echo "OK!"

你可能感兴趣的:(cgi调用bash:解析http get请求的参数)