[英]Bash script date error
i'm trying to get an old date in a bash script, but it throws this error 我试图在bash脚本中获取旧日期,但它会抛出此错误
"./bkc.sh: line 10: 20130122: command not found"
It's like tries to use the result date as a function instead of assign the value to the OLDATE var. 这就像尝试将结果日期用作函数而不是将值赋给OLDATE var。
Here's my code: 这是我的代码:
OLDATE= `date -d '7 days ago' +'%Y%m%d'`
Can anyone help me ? 谁能帮我 ? Thanks
谢谢
Just remove the space between OLDATE and the command. 只需删除OLDATE和命令之间的空格即可。
Bash doesn't want spaces in assigning values Bash在分配值时不需要空格
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.