Shell Script Quick Sheet

The following link containing a quick sheet to start on Shell Script:


The Sheet has the following outline:
Relational operators
Pattern matching
Shell math
Test conditions
Flow control
Sample snippets
Special variables
Conditional commands
Trapping signals
Output redirection
Variable substitution

Continue reading

Shell Script for Leap Year

Hello every body,
i have below a nice script to tell year the year is Leap or NOT.just copy the following line into a new file name it leap.ksh

# Shell program to read any year and find whether leap year or not
# -----------------------------------------------
# Copyright (c) 2005 nixCraft project <http: //></http:>
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit for more information.
# -------------------------------------------------------------------------
# store year
#echo -n "Enter year (yyyy) : "
#read yy
# find out if it is a leap year or not
if [ $((yy % 4)) -ne 0 ] ; then
   : #  not a leap year : means do nothing and use old value of isleap
elif [ $((yy % 400)) -eq 0 ] ; then
   # yes, it's a leap year
elif [ $((yy % 100)) -eq 0 ] ; then
   : # not a leap year do nothing and use old value of isleap
   # it is a leap year
if [ "$isleap" == "true" ];
   echo "YES"
   echo "NOT"

Continue reading

Script to list all LPARs on all Managed Systems Connected to HMC

if you have Many Managed Systems connected to HMC and you need to list ALL LPARs that you have on a table view like the following output:

Server Name : Server-****-***-***
LPAR Name          LPAR Number   IP Address
TEST1                             5             
TEST2                            4             
TEST2                             3            
TEST4                            2             
LPAR                              1             
VIO                                  6            

Continue reading