AIX Smit fast path
id : 3r1sliskr3
category : computer
blog : unixlinux
created : 07/30/10 - 11:06:28

Tired of search smit fast path, use this script to list all smit fast path containing a word.
.01#!/usr/bin/ksh
.02########################################################
.03# Written by : Benoit C (BCU)
.04# Purpose : List smit shortcuts containing a pattern
.05# Date : July 23, 2010
.06########################################################
.07
.08####################
.09# Define variables
.10####################
.11ODMDIR=/usr/lib/objrepos
.12
.13#################
.14# Usage function
.15#################
.16function usage {
.17  print "Usage : $1 "
.18  print "Return all smit shortcuts containing "
.19}
.20
.21#####################
.22# Get paths function
.23####################
.24function get_paths {
.25  MY_ARG=$1
.26  odmget sm_menu_opt | awk '( $1=="id" || $1=="next_id" ) && ! x[$3]++ {gsub("\"","",$3) ; print $3}' | grep -i $1
.27}
.28
.29##############
.30# Begin code
.31##############
.32if [[ $# -ne 1 ]]; then # if bad args number
.33  usage $0
.34  exit 1
.35else
.36  if [[ $1 = *-h* || $1 = *--help* ]]; then # if help called
.37    usage $0
.38    exit 1
.39  else
.40    print `get_paths $1` | tr ' ' '\n'
.41  fi
.42fi