I'm using dash and I need to create CGI script that will parse the query string and save each value to a variable
OLDIFS=$IFS
// use & as delimeter
IFS='&'
//this will loop the queryString variable
for line in $queryString;
do
//check if the key = action, if the condition was satisfied it will save the line to a variable..
//if the key is equal to type etc. etc.
echo "{$line,1}"
if[{$line,1}="action="]
then
cgi_action={$line,8}
elif[{$line,1}="type="]
then
cgi_type={$line,6}
fi
done
IFS=$OLDIFS
Im sure that I have errors to get the substring of the line (or string). but the question is the for loop is already expecting the done keyword. What's the correct way to write an if condition inside for loop in dash shell scripting.
Additional info, im using ubuntu 14.04,
Aucun commentaire:
Enregistrer un commentaire