| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- #!/bin/sh
- #
- #
- # This script defines some helper functions to be used in
- # other scripts so as to not have to define them every time
- # they are used.
- #
- #
- ############################################################
- # make echo more portable
- #
- #
- echo_print() {
- #IFS=" " command
- eval 'printf "%b\n" "$*"'
- }
- echo_n_print()
- {
- eval 'printf "%b" "$*"'
- }
- ############################################################
- #
- # expand debug output
- #
- echo_debug() {
- if [ "$DEBUG" = "true" ] ; then
- $ECHO "$*"
- $ECHO "$*" >> $DEBUG_FILE
- fi
- }
- ############################################################
- #
- # time stamp
- #
- setTime() {
- # set time
- NOW="`date '+%m/%d/%Y %H:%M %Z'`"
- }
- setAlias() {
- unalias -a
- cmd_list="printf
- touch
- cat
- more
- grep
- egrep
- cut
- find
- uname
- awk
- sed
- sort
- uniq
- expr
- cksum
- ps
- rm
- ls
- "
- path_list="/bin/
- /usr/bin/"
- for c in $cmd_list
- do
- alias_flag=0
- for p in $path_list
- do
- if [ -x ${p}${c} ];
- then
- alias ${c}=${p}${c}
- alias_flag=1
- break
- fi
- done
- if [ $alias_flag -eq 0 ] ; then
- if [ "${alias_not_found}" = "" ]; then
- alias_not_found=$c
- else
- alias_not_found=${alias_not_found},$c
- fi
- fi
- done
- if [ "${alias_not_found}" != "" ]; then
- eval 'printf "${alias_not_found} utility(ies) not found. Please contact your assigned consultant"'
- exit 600
- fi
- #alias
- }
- ECHO="echo_print"
- ECHON="echo_n_print"
|