开发者

how to translate the hostname solaris?

can any one translate or explain the following unix script for me please, when i actually run the script in the solaris server, it gives me the server name, but not really sure how this script work, can any one explain it in simple baby language ? Thanks

TEXTDOMAIN=SUNW_OST_OSCMD export TEXTDOMAIN

if [ $# -eq 0 ]; then
        /bin/uname -n
elif [ $# -eq 1 ]; then
        /bin/uname -S $1
else
        echo `/bin/gettext "Usage: hostname [name开发者_如何学编程]"`
        exit 1
fi


$# reads command line arguments

if there are none call uname -n

if there is one call uname -S $1 (which is the command line argument.)

See man uname to discover the differences in these calls.


If the script is executed with 0 arguments it will just run uname manpage printing you system name

if script is executed with 1 argument it will change your system name ( you have to be superuser)

else prints usage

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜