Portal Home > Knowledgebase > Articles Database > Need Help Shell Script


Need Help Shell Script




Posted by circuscircus, 10-04-2007, 09:47 AM
bin/sh echo() { /sbin/ip route add blackhole 198.87.51.13 /sbin/ip route add blackhole 63.78.151.98 /sbin/ip route add blackhole 58.71.22.77 exit 0; } #Functionality: Run that and it blocks those IPs ---------------------------- This is the first time I am writing a shell script so bare with it...I'm not a systems admin by any means. Could someone let me know what I did wrong and what would be the best resource to use to learn how to write shell scripts?

Posted by domainworldaccess, 10-04-2007, 10:00 AM
You should use fail rather than blackhole. Blackhole uses resources that failing does not. Google the 2 terms and you will find lots of data.

Posted by sirius, 10-04-2007, 10:35 AM
Moved to Technical and Security Issues.... Sirius

Posted by david510, 10-05-2007, 08:17 AM
circuscircus, There is no syntax error for the script you have wrote. Do you get any error? Google will easily show you good docs on shell scripts.

Posted by Patrick, 10-05-2007, 10:21 AM
The shell script above does nothing... at all. Here: If that's all you wanted the shell script to do was run those 3 commands... there you go. It's not fancy, but it works.

Posted by david510, 10-05-2007, 10:44 AM
Pat... you made it clear... I just had only one look..

Posted by foobic, 10-05-2007, 09:20 PM
What you've actually done is to create a function called "echo" (not the best choice of name ) but you never call it. If you add the single line at the end of your file it will do what you want (but then so will Pat's simpler version). This is a good guide for shell scripting: http://www.linux-france.org/lug/ploug/doc/abs-guide.pdf



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
need DNS consultation (Views: 524)