mountianman
10-02-2003, 04:04 PM
Hello,
I am trying to write a cgi script in Bash to process some information then search for it. So far I can get the query_string and gawk out the variables that I want. Once I get the variables I try to search a folder wich I named Companys. There are 2 variables that I'm trying to input into the final command, but I think my syntax may be wrong. below is a copy of the script, I would be greatful for any help.
#!/bin/bash
echo "Content-Type: text/html"
echo ""
compname=$(echo $QUERY_STRING | gawk -F'&' '{print $1}' | gawk -F= '{print $2}')
lsdnum=$(echo $QUERY_STRING | gawk -F'&' '{print $2}' | gawk -F= '{print $2}')
result=$(find $lsdnum/var/www/cgi-bin/companys/$compname)
echo $result >> companys/search.txt
END SCRIPT
I testing everything, and I can write all the information to the search.txt file manually. But when I try to run the finaly 2 commands they information doesn't append into the file. Can you put variables directly into a command in the way that I did? Thanks.
Jay
I am trying to write a cgi script in Bash to process some information then search for it. So far I can get the query_string and gawk out the variables that I want. Once I get the variables I try to search a folder wich I named Companys. There are 2 variables that I'm trying to input into the final command, but I think my syntax may be wrong. below is a copy of the script, I would be greatful for any help.
#!/bin/bash
echo "Content-Type: text/html"
echo ""
compname=$(echo $QUERY_STRING | gawk -F'&' '{print $1}' | gawk -F= '{print $2}')
lsdnum=$(echo $QUERY_STRING | gawk -F'&' '{print $2}' | gawk -F= '{print $2}')
result=$(find $lsdnum/var/www/cgi-bin/companys/$compname)
echo $result >> companys/search.txt
END SCRIPT
I testing everything, and I can write all the information to the search.txt file manually. But when I try to run the finaly 2 commands they information doesn't append into the file. Can you put variables directly into a command in the way that I did? Thanks.
Jay