Random Functions for ksh

# Prints the username@hostname in the title of an xterm echo “\033]0;${USER}@${HOSTNAME}\007” # A ksh function similar to perl’s chomp function. Thanks to an OS Plumber chomp() { # Usage: $1 is string to chomp, $2 is char to chomp off := defaults to \n char=${2:=$’\n’} echo “${1%$char}” } center() { c_width=$(tput cols) c_text=”$*” c_width=$(( … Read moreRandom Functions for ksh

playing with arrays

#!/bin/kshprint “Array Parent has properties and contains many children with properties.”parent=( name=IV99999 vers=”6.1.8″ fileset=”bos.mp.6.1.8.1.bff.U” typeset -a children )parent.children+= ( name=”IV01111″ vers=”Applies to 6.1.0″ fileset=”bos.mp.6.1.5.17.bff.U” )parent.children+= ( name=”IV01297″ vers=”Applies to 6.1.7″ fileset=”bos.mp.6.1.7.9.bff.U” )parent.children+= ( name=”IV06297″ vers=”Applies to 6.1.5″ fileset=”bos.mp.6.1.5.17.bff.U” )print “${parent.name} ${parent.vers}\n${parent.fileset}”for (( i=0; i<${#parent.children[@]}; i++ ))doprint “\t${parent.children[$i].name} ${parent.children[$i].vers}\n\t\t${parent.children[$i].fileset}”done  

Categories AIX
Soapbox Artist: collecting art & literature of the worst kind