- 論壇徽章:
- 2
|
- 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ù)制代碼 剛剛寫(xiě)的,很多錯(cuò)誤,我把后面的都注釋掉了,就是前面的那一小段代碼也有問(wèn)題,求助!! |
|