tags:

views:

15

answers:

1

Hello, 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.

A: 

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;
prodigitalson
bah - thanks. fixed it.
Carlos