I'm using this script to backup an old private instance of postgresql to gmail periodically:
#!/bin/bash
/opt/local/lib/postgresql83/bin/pg_dump maxgests -U postgres | gzip --best -c > $1 && (/opt/local/bin/mutt -s `date "+%d-%m-%Y-%H:%M"` -a $1 $2 < /dev/null)
As of late I'm getting this:
./postgres_to_gmail.sh: line 2: $1: ambiguous redirect
And the script no longer works. Mac OS X 10.6.8.
Can anytone tell what's wrong and how to fix it?
First argument is a path, like /tmp/database.gz
Second argument is the email.
$1
is apparently empty.
As a general guidance, you should put your variable interpolations in double quotes, nearly always.
the caller doesn't set the arguments ($1 $2) you should check the crontab or the program which calls is periodically more
$ echo > $1
bash: $1: ambiguous redirect
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With