Shell-script question
I wrote a shell script "/usr/local/bin/mailcheck" (/usr/local/bin/ is in
$PATH of my potato bash) that gives a list of pon "targets" (diff.
ISPs), and is owned by root., perms 755. I've virtually no experience
with shell scripting, so it may be poor quality. Anyway: If the script
is invoked from a command line within or outside X, it works. If it's
invoked via "rxvt -e mailcheck" or "rxvt -ls -e mailcheck", everything
looks normal, but nothing's dialed.
Andre Berger [andre.berger@topmail.de]
#!/bin/sh
# /usr/local/bin/mailcheck
# Auswahldialog fuer Nur-Mailcheck-PPP-Verbindungen
isplist="/tmp/isplist"
rm $isplist 2> /dev/null
providerlist=$(ls /etc/ppp/peers/ | grep -v bak | grep -v \~)
dialogtext="Email checken und Verbindung BEENDEN"
isp=
j="1"
while [ -z "$isp" ]; do
echo -e "$dialogtext:\n"
for i in $providerlist; do
echo "["$j"]" $i
echo "["$j"]" $i >> $isplist
j=$[$j+1]
done
echo -e "\n[0] Abbrechen\n"
echo -n "Auswahl: "
read isp
isp=${isp##[^0-9]*}
if [ "$isp" = "0" ]; then
rm $isplist 2> /dev/null
echo "Abgebrochen."
exit 1
else
if [ -z "$isp" ]; then
echo "Unbekannt, bitte Eingabe wiederholen"
fi
fi
sleep 1
done
dialisp=$(cat $isplist | grep "["$isp"]" | mawk '{print $2}')
rm $isplist 2> /dev/null
echo -e -n "[$isp] $dialisp...\n"
sleep 1
touch $HOME/NURMAIL
exec pon $dialisp
Reply to: