This commit is contained in:
2019-01-31 23:39:52 -06:00
parent 12ebc376a4
commit 45a8c9ebe9
2 changed files with 14 additions and 4 deletions

View File

@@ -64,7 +64,6 @@ detect_os () {
__resultvar[MACH]=`uname -m`
if [ -f /etc/redhat-release ] ; then
echo DISTRIBUTION=redhat
echo FAMILY=rh
local FILE=/etc/redhat-release
grep -i 'red.*hat.*enterprise.*linux' $FILE 2>&1 > /dev/null && { echo DERIVATIVE=rhel; return; }
grep -i 'red.*hat.*linux' $FILE 2>&1 > /dev/null && { echo DERIVATIVE=rh; return; }
@@ -89,7 +88,6 @@ detect_os () {
echo FAMILY=rh
elif [ -f /etc/debian_version ] ; then
__resultvar[DISTRIBUTION]=debian
__resultvar[FAMILY]=debian
if which lsb_release 2>&1 > /dev/null ; then
__resultvar[DERIVATIVE]=`lsb_release --id --short 2> /dev/null`
__resultvar[RELEASE]=`lsb_release --release --short 2> /dev/null`

16
test.sh
View File

@@ -18,6 +18,18 @@ fi
detect_os OS
function myfunc()
{
local -n myresult="$1" || return 1
myresult[0]="a"
myresult[1]="b"
myresult[2]="c"
myresult[3]="d"
myresult[4]="e"
}
# call function that constructs the array with the array name
myfunc targetvalue
# display it
declare -p targetvalue
echo $OS