#!/bin/bash if [[ $# != 2 ]] { echo >&2 "Usage $0 BASH_PROGRAM PREFIX> !2 "Usage $0 BASH_PROGRAM PREFIX" exit 3 } setglobal SH_PROG = $1 setglobal PREFIX = $2 typeset -i rc = '0' setglobal bash_loc = $[$SH_PROG -c 'echo ${SHELL}] setglobal rc = $Status if sh-expr ' rc != 0 ' { echo >&2 "Something went wrong in getting \$SHELL for $SH_PROG> !2 "Something went wrong in getting \$SHELL for $SH_PROG" exit $rc } if [[ -z $bash_loc ]] { echo >&2 "Something went wrong in setting bash location from \$SHELL for $SH_PROG> !2 "Something went wrong in setting bash location from \$SHELL for $SH_PROG" exit 3 } setglobal bashdb_main = $[strings $SH_PROG | grep bashdb] setglobal check_loc = $[dirname $[dirname $bashdb_main]] if [[ $PREFIX != $check_loc ]] { echo >&2 "bash says prefix should be $check_loc. You gave $PREFIX> !2 "bash says prefix should be $check_loc. You gave $PREFIX" exit 4 } exit 0