0

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

1 Answer 1

2

Just remove the space between OLDATE and the command.

Bash doesn't want spaces in assigning values

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! What a rookie mistake!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.