update
This commit is contained in:
@@ -64,7 +64,6 @@ detect_os () {
|
|||||||
__resultvar[MACH]=`uname -m`
|
__resultvar[MACH]=`uname -m`
|
||||||
if [ -f /etc/redhat-release ] ; then
|
if [ -f /etc/redhat-release ] ; then
|
||||||
echo DISTRIBUTION=redhat
|
echo DISTRIBUTION=redhat
|
||||||
echo FAMILY=rh
|
|
||||||
local FILE=/etc/redhat-release
|
local FILE=/etc/redhat-release
|
||||||
grep -i 'red.*hat.*enterprise.*linux' $FILE 2>&1 > /dev/null && { echo DERIVATIVE=rhel; return; }
|
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; }
|
grep -i 'red.*hat.*linux' $FILE 2>&1 > /dev/null && { echo DERIVATIVE=rh; return; }
|
||||||
@@ -89,7 +88,6 @@ detect_os () {
|
|||||||
echo FAMILY=rh
|
echo FAMILY=rh
|
||||||
elif [ -f /etc/debian_version ] ; then
|
elif [ -f /etc/debian_version ] ; then
|
||||||
__resultvar[DISTRIBUTION]=debian
|
__resultvar[DISTRIBUTION]=debian
|
||||||
__resultvar[FAMILY]=debian
|
|
||||||
if which lsb_release 2>&1 > /dev/null ; then
|
if which lsb_release 2>&1 > /dev/null ; then
|
||||||
__resultvar[DERIVATIVE]=`lsb_release --id --short 2> /dev/null`
|
__resultvar[DERIVATIVE]=`lsb_release --id --short 2> /dev/null`
|
||||||
__resultvar[RELEASE]=`lsb_release --release --short 2> /dev/null`
|
__resultvar[RELEASE]=`lsb_release --release --short 2> /dev/null`
|
||||||
|
|||||||
16
test.sh
16
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
|
|
||||||
Reference in New Issue
Block a user