亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区
Chinaunix
標(biāo)題:
這個程序老是提示有錯誤是怎么回事?
[打印本頁]
作者:
mosquitoh
時間:
2015-03-12 18:35
標(biāo)題:
這個程序老是提示有錯誤是怎么回事啊?
read -p "please input your damozilition date: " date2
date_check=$(echo $date2 | grep '[0-9]\{8\}')
if [ "$date_check" == "" ]; then
echo "you input the wrong data format..."
exit 1
fi
#declare -i date_dem=`date --date="$date2" +%s`
#declare -i date_now=`date --date="date" +%s`
#declare -i date_total_s=$(($date_dem-$date_now))
#declare -i date_d=$(($date_total_s/60/60/24))
#declare -i date_hour=$(($(($date_total_s - $date_d*24*60*60))/60/60))
#declare -i date_sec=$(($date_total_s - $date_d*24*60*60 - $date_hour*60))
#
#if [ "$date_total_s" lt "0" ]; then
# echo "You had been demolization " $date_d " days " $date_hour " hours " $date_sec "seconds"
#else
# echo "You will demolization after " $date_d " days " $date_hour " hours " $date_sec " seconds"
#fi
復(fù)制代碼
剛剛寫的,很多錯誤,我把后面的都注釋掉了,就是前面的那一小段代碼也有問題,求助!。
作者:
mosquitoh
時間:
2015-03-12 18:38
sh11.sh: 4: [: 20091223: unexpected operator
作者:
zsszss0000
時間:
2015-03-12 18:59
我運(yùn)行就沒有問題啊
作者:
mosquitoh
時間:
2015-03-12 19:36
我的是ubutun 14.10,老是提示
sh11.sh: 4: [: 20091223: unexpected operator
怎么回事?
作者:
zsszss0000
時間:
2015-03-12 19:43
本帖最后由 zsszss0000 于 2015-03-12 19:44 編輯
你在第四行之前價格打印
echo $date_check
復(fù)制代碼
看看你獲取的date_check是什么?
回復(fù)
4#
mosquitoh
作者:
mosquitoh
時間:
2015-03-12 19:57
原來要把第四行的“==”改為“=”
求解答????
作者:
zsszss0000
時間:
2015-03-12 20:17
本帖最后由 zsszss0000 于 2015-03-12 20:19 編輯
http://72891.cn/thread-1048907-1-1.html
根據(jù)這篇帖子,shell中的=不是賦值而是字符串比較運(yùn)算符號
回復(fù)
6#
mosquitoh
作者:
mosquitoh
時間:
2015-03-12 20:33
謝謝了,終于調(diào)試完成運(yùn)行成功,代碼如下,和鳥哥寫的做了一點修改,
read -p "please input your damozilition date: " date2
date_check=$(echo $date2 | grep '[0-9]\{8\}')
if [ "$date_check" = "" ]; then
echo "you input the wrong data format..."
exit 1
fi
declare -i date_dem=$(date --date="$date2" +%s)
declare -i date_now=`date +%s`
declare -i date_total_s=$(($date_dem-$date_now))
declare -i date_d=$(($date_total_s/60/60/24))
declare -i date_hour=$(($(($date_total_s - $date_d*24*60*60))/60/60))
declare -i date_min=$(($(($date_total_s - $date_d*24*60*60 - $date_hour*60*60))/60))
if [ "$date_total_s" -lt "0" ]; then
echo "You had been demolization" $((-1*$date_d)) "days" $((-1*$date_hour)) "hours" $((-1*$date_min)) "minutes"
else
echo "You will demolization after" $date_d "days" $date_hour "hours" $date_min "minutes"
fi
復(fù)制代碼
作者:
zsszss0000
時間:
2015-03-12 20:38
看來是這個版本的shell不支持==導(dǎo)致的問題
歡迎光臨 Chinaunix (http://72891.cn/)
Powered by Discuz! X3.2