_exec()
{
CMD="$1"
echo "Executing command: $CMD"
EXEC_OUT=`$CMD`
EXEC_RET=$?
}
_exec "hostname|cut -d\".\" -f1 "
SHORT_NAME=$EXEC_OUT
if [ $EXEC_RET -ne 0 ];then
echo "Unable to determine shortname of server"
else
echo $EXEC_OUT
fi
为什么下面的shell脚本函数失败了?
•
shell