#!/bin/ksh ## ## SCRIPT: dirname_levnum ## ## Where: in $FEDIR/scripts where $FEDIR=/apps/nns_com/fea ## ########################################################################## ## PURPOSE: For a given (fully-qualified) directory name, this script ## shows the level number of the directory --- determined by ## the number of slashes in the directory name. ## ########################################################################## ## CALLED BY: in the 'find' command in the script ## 'dirnames_all_levs_groupBYlev_bygui' ## in $FEDIR/scripts. ## ## Can use ./FIND_NOT_IN_OLD '' ## in the $FEDIR/scripts & $FEDIR/tkGUIs directories, ## to show other ksh or tk scripts that use ''. ########################################################################## ## CALL FORMAT: Example from 'dirnames_all_levs_groupBYlev_bygui' : ## ## find $DIRNAME -local -type d -exec $FEDIR/scripts/dirname_levnum {} \; ## ########################################################################## ## INPUT & OUTPUT: ## Input is a directory name, in $1. ## Output is the directory name, preceded by the level number, to stdout. ########################################################################## ## MAINTENANCE HISTORY: ## Written by: Blaise Montandon 26apr2004 Based on ## 'dirnames_all_levs_bygui' ## in $FEDIR/scripts ## Updated by: Blaise Montandon 26apr2004 ########################################################################### DIR_IN="$1" ## FOR TESTING: # DIR_IN="/apps/nns_com/fea/Dscrtest" LEVNUM=`echo "$DIR_IN" | tr -c -d '/' | wc -c | awk '{printf ("%3s\n", $1)}'` echo "$LEVNUM $DIR_IN"