To ban an ip with iptables:

iptables -A INPUT -s 195.195.195.195 -j DROP
service iptables save
service iptables restart

if you want to do that with bash here is a simple script that asks you for theip to ban then bans it:

iptables -A INPUT -s 195.195.195.195 -j DROP
echo -n "Enter the ip [ENTER]: "
read ip
iptables -A INPUT -s $ip -j DROP
service iptables save
service iptables restart

Thanks for visiting.