AIX Shell Scripting Made Simple
Shell scripting is much like having a power tool instead of using a screwdriver, although as with everything else, it's always prudent to have the right tool for the right job. You might not need a power tool to screw in a single screw, but if you have 200 screws, you’ll appreciate the power tool.
It’s the same with shell scripting. If you need to pull information from multiple servers, instead of logging into each individually, you can write a basic shell script to perform that function. Let's dissect a basic shell script. This example is a simple script to report OS levels:
_list_of_servers="mars earth saturn jupiter"
# Main Code
for _server in $_list_of_servers
echo "$_server OS Level:"
ssh $_server "oslevel -s"
Now this script is going to go out and report the OS level from servers: mars, earth, saturn and jupiter. If you run the script ./script.sh you'll get the following output:
Search our new 2013 Buyer's Guide.
Web Exclusive | Versioned WPARs enable legacy applications on POWER7
E-Newsletter | Tips for a Smooth Handoff of Power Systems Knowledge