loong qiang
像风一样自由

#! /bin/bash

name=`basename $0`
echo $name=======================================
if [ "$name" == "addem" ]
then
echo $name+++++++++++++++
total=$[ $1 + $2 ]
elif [ "$name" == "multiem" ]
then
echo $name########################
total=$(( $1 * $2 ))
fi
echo the calcuated value is $total

====================== 华丽的分割线=========================================

昨天晚上写的总有问题,以为脚本有问题,今天重新测试了下,发现木有问题,难道晚上头脑易混乱…………………………

#! /bin/bash
name=`basename $0`
echo $name===========================================
if [ $name = "addem" ]
then
echo $name+++++++++++++++++++++++
total=$[ $1 + $2 ]
elif [ $name = "multiem" ]
then
echo $name###########################
total=$(( $1 * $2 ))
fi
echo the total result is $total

#! /bin/bash
name=`basename $0`
echo $name===========================================
if [ "$name" == "addem" ]
then
echo $name+++++++++++++++++++++++
total=$[ $1 + $2 ]
elif [ "$name" == "multiem" ]
then
echo $name###########################
total=$(( $1 * $2 ))
fi
echo the total result is $total

=和== 等效

 

posted on 2013-12-03 13:45  loong qiang  阅读(292)  评论(0编辑  收藏  举报