I wrote a script that would zip a folder and then store it another. So far this is working great. But now I want to send it using scp. I want to use eval so I can change them easily. But when I use it to send the file to some destination it always tells me that the the directory or file does not exist. If I do it without $scriptd then it is working like a charm.
Any ideas why?
#!/bin/bash
# Implementation of variables
today=$(date +"%Y-%m-%d")
source="~/Documents"; eval source=$source
target="~/Backups"; eval target=$target
scriptd="~/Documents/Backups"; eval scriptd=$scriptd
main(){
backup
}
backup(){
tar -zvcf $today.tar.gz -P $source
rsync -zhap --progress $scriptd/$today.tar.gz $target
rm $scriptd/$today.tar.gz
scp $target/$today.tar.gz pi@I-Am-An-IP:$scriptd
}
main
exit 0