亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 1947 | 回復(fù): 3
打印 上一主題 下一主題

新手求助:如何在HP-UX下獲得前一日的日期 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2006-06-14 00:09 |只看該作者 |倒序?yàn)g覽
date +'%m%d'  可以取到當(dāng)前日期,格式為mmdd

但是我現(xiàn)在需要得到昨天的日期,格式仍為mmdd,請(qǐng)教高手如何實(shí)現(xiàn)?

一定需要寫shell才能實(shí)現(xiàn)的么?

論壇徽章:
0
2 [報(bào)告]
發(fā)表于 2006-06-14 09:13 |只看該作者
貼出我的代碼的一部分

  1. # step 1, generate application statistics at the morning for yesterday
  2. get_one_day_before_specified_date()
  3. {
  4. #get the command line input(date month & year)
  5.     day=$1
  6.     month=$2
  7.     year=$3

  8.     # if it is the first day of the month
  9.     if [ $day -eq 01 ]
  10.     then
  11.         # if it is the first month of the year
  12.         if [ $month -eq 01 ]
  13.         then
  14.             # make the month as 12
  15.             month=12

  16.             # deduct the year by one
  17.             year=`expr $year - 1`
  18.         else
  19.             # deduct the month by one
  20.             month=`expr $month - 1`
  21.         fi
  22.          
  23.         # use cal command, discard blank lines,
  24.         # take last field of last line,   
  25.         # first awk  command is used to get the
  26.         # last useful line of the calendar cmd,
  27.         # second awk command is used to get the   
  28.         # last field of this last useful line,
  29.         # NF is no. of fields,
  30.         # $NF is value of last field

  31.                 day=`cal $month $year | awk 'NF != 0{ last = $0 }; END{ print last }' |  awk '{ print $NF }'`
  32.     else
  33.         # deduct the day by one
  34.         day=`expr $day - 1`
  35.     fi

  36.     # echo $month $day $year
  37.     year_2dig=`echo $year|awk '{print substr($0,3)}'`
  38.     echo $month/$day/$year_2dig
  39. }

  40. YEAR_T=`date +%Y`;
  41. MONTH_T=`date +%m`;
  42. DAY_T=`date +%d`;

  43. YESTERDAY=`get_one_day_before_specified_date $DAY_T $MONTH_T $YEAR_T`;

  44. # echo "===============${YESTERDAY}==================";
復(fù)制代碼

論壇徽章:
0
3 [報(bào)告]
發(fā)表于 2006-06-14 09:13 |只看該作者
我的主機(jī)就是HP11i

論壇徽章:
0
4 [報(bào)告]
發(fā)表于 2006-06-15 12:49 |只看該作者
多些,我的主機(jī)也是11的。怎么說是貼出代碼的一部分,難道還有下文?
先試試看了。
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP