为什么这两个等价

sh/bash/dash/ksh/zsh等Shell脚本
回复
yzq8951
帖子: 9
注册时间: 2008-08-02 12:03
来自: 南京

为什么这两个等价

#1

帖子 yzq8951 » 2008-11-12 13:36

就是
#!/bin/bash
# Program:
# User can input 2 integer to cross by
#History:
#2008/11/12 yzq8951
PATH=/bin:/sbin:/usr/sbin:/usr/local/bin:/use/local/sbin:/~/bin
export PATH
echo -e "You should input 2 numbers ,I will cross they"
read -p "first number:" firstnu
read -p "second number:" secnu
declare -i total=$firstnu*$secnu
echo -e "\nThe number $firstnu * $secnu is ==> $total"

declare -i total=$firstnu*$secnu和total=$(($firstnu*$secnu ))是等价的 我对这个$()不太懂
一直在学习~~
头像
bones7456
帖子: 8495
注册时间: 2006-04-12 20:05
来自: 杭州
联系:

Re: 为什么这两个等价

#2

帖子 bones7456 » 2008-11-12 13:39

等价就等价了,还为什么? :em05
注意兼容性就好了.
关注我的blog: ε==3
头像
xiooli
帖子: 6956
注册时间: 2007-11-19 21:51
来自: 成都
联系:

Re: 为什么这两个等价

#3

帖子 xiooli » 2008-11-12 14:02

(())里面的和c语言语法相同。
回复