2012-10-16 26 views

cevap

26

yardım edin. Başka bir deyişle

:

testFunction() 
{ 
    k=5 
    echo 3 
    return $k 
} 

val=$(testFunction) 
echo $? # prints 5 
echo $val # prints 3 
-2

Bu Ksh fonksiyonları çalışır:

IPADDRESS()  # get the IP address of this host 
{ 
    # purpose: to get the IP address of this host 
    #  and return it as a character string 
    # 
    typeset -l IPADDR 
    IPADDR=$(ifconfig -a | grep inet | grep -v '127.0.0.1' | awk '{print $2}') 
    print $IPADDR 
} 

IP_Address=$(IPADDRESS) 
echo $IP_Address 
exit 
İlgili konular