shell-script-pt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [shell-script] Cgi x Perl


From: Listas XTMS
Subject: Re: [shell-script] Cgi x Perl
Date: Thu, 20 Feb 2003 14:37:58 -0300

Jeito 1:

#!/bin/bash
#source /usr/local/lib/bashlib
echo "Content-type: text/html"
echo ""
echo "<html><title>Teste</title><body>"
echo "Ola!"
echo "<br>"
echo "<br>"
echo "<br>"
echo "<ul>"
echo "<form method="post" action='teste2'>"
echo "String a localizar: "
echo "<input name="ABC" type="text" size="30" maxlength="30">"
echo "<input type="submit" name="Submit" value="submit">"
echo "</form>"
echo "<br><br>"
variavel=$(sed -n '1p')
RESPOSTA=`echo $variavel|cut -d "&" -f 1|cut -d "=" -f2|tr -s "+" " "`
echo "<br>"
if [ ! -z "$RESPOSTA" ]; then
grep -r $RESPOSTA *
fi
echo "<br>"
echo "<br>"
echo "<br>"
echo "<br>"
echo "</body></html>"


Jeito 2: (necessário instalar bashlib)

#!/bin/bash
. /usr/local/lib/bashlib
echo "Content-type: text/html"
echo ""
echo "<html><title>Teste</title><body>"
echo "Ola!"
echo "<br>"
echo "<br>"
echo "<br>"
echo "<ul>"
echo "<form method="post" action='teste2'>"
echo "String a localizar: "
echo "<input name="string" type="text" size="30" maxlength="30">"
echo "<input type="submit" name="Submit" value="submit">"
echo "</form>"
echo "<br><br>"
RESPOSTA=`param string`
echo "<br>"
if [ ! -z "$RESPOSTA" ]; then
grep -r $RESPOSTA *
fi
echo "<br>"
echo "<br>"
echo "<br>"
echo "<br>"
echo "</body></html>"




Em ambos os casos deixe o script executável e jogue no seu diretório de cgis.


[]'s
Eri Ramos Bastos


reply via email to

[Prev in Thread] Current Thread [Next in Thread]