0

I am having trouble making this work and am looking for some help.

Currently i have a file dumped into my directory every day with the date as the file name (say "100928.zip") and I am trying to setup a cron job to unzip it but figured i'd test it first.

Using OSX Terminal.

This is what I am doing....

iDate='date +%y%m%d'; unzip -uod domains/mydomain/directory/$iDate;

However I get an error...

unzip: cannot find or open +%y%m%d, +%y%m%d.zip or +%y%m%d.ZIP.

Any help would be appreciated.

Thanks.

1 Answer 1

1

You need to use backticks (`) to execute the command and put its return in the variable.

iDate=`date +%y%m%d`; unzip -uod domains/mydomain/directory/$iDate;
Sign up to request clarification or add additional context in comments.

Comments

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.