From 45a8c9ebe99a68b7ed3514c01f88a2ffcf0a8269 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Thu, 31 Jan 2019 23:39:52 -0600 Subject: [PATCH] update --- default.inc | 2 -- test.sh | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/default.inc b/default.inc index a0e37fe..40ddca2 100755 --- a/default.inc +++ b/default.inc @@ -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` diff --git a/test.sh b/test.sh index de8965a..1f7bc3a 100755 --- a/test.sh +++ b/test.sh @@ -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 \ No newline at end of file