Menu

[69de4e]: / check-prefix.sh  Maximize  Restore  History

Download this file

26 lines (24 with data), 591 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
if [[ $# != 2 ]]; then
echo >&2 "Usage $0 BASH_PROGRAM PREFIX"
exit 3
fi
SH_PROG=$1
PREFIX=$2
typeset -i rc=0
bash_loc=$($SH_PROG -c 'echo ${SHELL}')
rc=$?
if (( rc != 0 )) ; then
echo >&2 "Something went wrong in getting \$SHELL for $SH_PROG"
exit $rc
fi
if [[ -z $bash_loc ]] ; then
echo >&2 "Something went wrong in setting bash location from \$SHELL for $SH_PROG"
exit 3
fi
check_loc=$(./compute-prefix.sh $SH_PROG)
if [[ $PREFIX != $check_loc ]] ; then
echo >&2 "bash says prefix should be $check_loc. You gave $PREFIX"
exit 4
fi
exit 0
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.