Monday, April 19, 2010

The procedure to get numbers of installed patches on solaris

getpatchlevel ()                # This subprocedure generates the list of installed pathes and makes
                               # a readable output 

declare -a patch    # The array contains the all installed patches numbers
count=0             # The amount of array member

for i in `showrev -p | cut -c1-70 | awk '{print $2}'`
do
    patch[$count]=`echo $i`
    let "count = $count+1"
done

#Make the readable output: 6 patch per string
k=0
while [ $k -lt ${#patch[@]} ]
do
    echo ${patch[$k]} ${patch[$k+1]} ${patch[$k+2]} ${patch[$k+3]} ${patch[$k+4]} ${patch[$k+5]}
    let "k=$k+6"
done

}

No comments: