【问题标题】:Shell script datetime function?Shell脚本日期时间函数?
【发布时间】:2010-10-09 08:26:29
【问题描述】:

我正在运行以下脚本:

#!/bin/ksh
./clear_old
./rooms_xls.pl 2/23/09
cd doors
./doors_xls.pl 2/23/09

如何根据系统/服务器时间将日期设为今天的日期?

【问题讨论】:

    标签: shell date scripting ksh


    【解决方案1】:

    在 date 命令中使用反引号:

    ./rooms_xls.pl `date +%m/%d/%Y`
    

    【讨论】:

      【解决方案2】:

      这应该可以正常工作(并且几乎符合您的格式):

      #!/bin/ksh
      ./clear_old
      ./rooms_xls.pl `date +%D`
      cd doors
      ./doors_xls.pl `date +%D`
      

      【讨论】:

        【解决方案3】:

        $(date)

        作品

        【讨论】:

          猜你喜欢
          • 2014-09-29
          • 2021-09-06
          • 1970-01-01
          • 1970-01-01
          • 2011-07-21
          • 2014-06-27
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多