如何在上周获得bash sunos的日期
这是我的问题:我有一个备份bash脚本,需要访问带有日期名称的文件夹:backup_01072022。
我使用 date =`tz = gmt +24 date +%d%m%y`
当我需要访问昨天的备份文件夹时。
现在,我想访问上周的备份文件夹:
date =`tz = gmt +168日期 +%d%m%y`
,它不起作用,它显示了今天的日期。
我读到TZ不适合+144以上的值。
在 sunos 6.8 中,还有其他操纵日期吗?
注意:
sunos 6.8
版本的 date
util:8.5
版本的bash:4.1.11(2)-Release
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这将取决于系统上
date
的版本。使用
GNU日期
(V 8.26):注意:我将其保留为OP,以确定是否应调整显式
tz
设置(或根本使用)This'll depend on the version of
date
on your system.With
GNU date
(v 8.26):NOTE: I'll leave it up to OP to determine if the explicit
TZ
setting should be adjusted (or used at all)我似乎还记得Sunos随附Perl,因此,如果您没有支持
的
,您应该能够做:date
- date =“ ...”I seem to recall SunOS comes with Perl, so if you don't have a
date
that supports--date="..."
, you should be able to do:多亏了有用的委托和答案,我能够使用它来实现它的工作:
事实证明,我没有使用
gnu date
util,直到我明确指定它,而这既不是- date nor
-d
为我工作。如果不是
gnu日期
,我仍然无法弄清楚我默认使用的util日期。Thanks to the helpful commments and answers I was able to make it work using :
It turns out I was not using the
GNU date
util until I specified it explicitly, and that's neither--date
nor-d
was working for me.I still can't figure out what date util I was using by default if not
GNU date
.