bash 在命令行上获取当前年份
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32161888/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Get the current year on the commandline
提问by Uli K?hler
Using wget, I need to download a file whose URL contains the year. How can I embed the current 4-digit year (at the time of running the command, e.g. 2015)? For example, what would the command currentyear
be in
使用 wget,我需要下载一个 URL 包含年份的文件。如何嵌入当前的 4 位数年份(在运行命令时,例如 2015)?例如,命令currentyear
是什么
wget "http://example.com/data-$(currentyear).txt"
What would be the corresponding command if I'd need the two-digit year (e.g. 15 for 2015)?
如果我需要两位数的年份(例如 2015 年为 15),相应的命令是什么?