From 3f6c1435a4cbdf73a65639b05898a01c0dfc21ac Mon Sep 17 00:00:00 2001 From: Pete Travis Date: Wed, 1 Oct 2014 11:33:51 -0600 Subject: we might need this sles10 stuff later --- .../bash-3.1-postpatch/examples/scripts/vtree3a | 100 +++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 scratch/bash-3.1-postpatch/examples/scripts/vtree3a (limited to 'scratch/bash-3.1-postpatch/examples/scripts/vtree3a') diff --git a/scratch/bash-3.1-postpatch/examples/scripts/vtree3a b/scratch/bash-3.1-postpatch/examples/scripts/vtree3a new file mode 100644 index 0000000..0678764 --- /dev/null +++ b/scratch/bash-3.1-postpatch/examples/scripts/vtree3a @@ -0,0 +1,100 @@ +#!/bin/bash +# +# Name: dirtree +# Programmer: +# Hemant T. Shah +# Life Insurance Data Processing +# July 12 1994 +# +# Description: +# Print directory tree structure as follows: +# |___Mail +# |___scheduler +# |___cics_scripts +# |___tar_msdos +# |___awk +# |___attributes +# |___tmp +# |___News +# |___dosscsi +# |___FAQ_xterminal +# |___shell_history.Z +# |___FAQ_AIX +# |___aix_ftp_site +# |___hp_software +# |___dnload +# |___telnet.h +# |___msdos +# |___tnetd.tar.Z +# |___aix +# |___hp +# |___xkey.c +# +# Conversion to bash v2 syntax done by Chet Ramey +# - removed command substitutions calling `basename' +# + +ProgramName=${0##*/} +Path="." +ShowAll=1 +ShowDir=0 + + +ExpandDirectory() +{ +local object # Local variable + +cd "$1" + +for object in $PWD/.??* $PWD/* +do + if [ -d $object ]; # It is a directory + then + echo "${indent}|___${object##*/}/" + indent="${indent}! " # Add to indentation + if [ -x $object ]; + then + ExpandDirectory $object + fi + indent=${indent%????} # Remove from indentation + elif [ -e $object ]; then + if (( ShowAll == 1 )); + then + echo "${indent}|___${object##*/}" + fi + fi +done + +} + +usage() +{ + echo -e "Usage: $ProgramName [-h] [-f] [-d] [path] " + echo -e "\t-h ... display this help message." + echo -e "\t-f path ... shows all files and directories below path (default)." + echo -e "\t-d path ... shows all directories only below path." +} + +while getopts "fd" opt +do + case $opt in + f) ShowAll=1 ;; + #d) ShowDir=1 ;; + d) ShowAll=0 ;; + *) usage ; exit 2;; + esac +done + +shift $(( $OPTIND - 1 )) + +Path=${1:-.} + +if [ ! -d "$Path" ]; then + echo "$0: error: specified path is not a directory." >&2 + exit 1 +fi + + + +echo "!$Path/" +ExpandDirectory $Path -- cgit