Reputation: 776
i'm trying to get an old date in a bash script, but it throws this error
"./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.
Here's my code:
OLDATE= `date -d '7 days ago' +'%Y%m%d'`
Can anyone help me ? Thanks
Upvotes: 0
Views: 158
Reputation: 6568
Just remove the space between OLDATE and the command.
Bash doesn't want spaces in assigning values
Upvotes: 2