I have a little bash script here I'm trying to fix but I keep getting a syntax error stating "Unexpected end of file". It asks if i want to block or unblock and asks which type of port and then errors out.
Any help would be greatly appreciated.
#!/bin/bash
PTYPET="What kind of port? [udp] or [tcp] or [both] :"
PTEXTT="What port? [number] :"
echo "Would you like to block or unblock? [b] or [u] :"
read choice
if [ $(choice) == "u" ]; then
echo $PTYPET
read port-type
echo $PTEXTT
read port
if [ $(ptype-text) == "both" ]; then
/sbin/iptables -A INPUT -p $port-type -m tcp --dport $port -j ACCEPT
/sbin/iptables -A INPUT -p $port-type -m udp --dport $port -j ACCEPT
else
/sbin/iptables -A INPUT -p $port-type -m $port-type --dport $port -j ACCEPT
fi
else
echo $PTYPET
read port-type
echo $PTEXTT
read port
if [ $(ptype-text) == "both" ]; then
/sbin/iptables -A INPUT -p $port-type -m tcp --dport $port -j DROP
/sbin/iptables -A INPUT -p $port-type -m udp --dport $port -j DROP
else
/sbin/iptables -A INPUT -p $port-type -m $port-type --dport $port -j DROP
fi