I have a problem with the expansion of my variables in the next script:
fecha="$(date +'%d.%m.%Y')"
bkfile=$bkpath"backup_"$fecha".tar.gz"
tempfile="/tmp/Backup_"$fecha".tar.gz"
declare -a commandlist=(
'tar -pczf $tempfile /tmp/MyBackup/*'
'mv $tempfile $bkfile'
)
for command in "${commandlist[@]}"
do
echo $command
done
It´s shows me:
tar -pczf $tempfile /tmp/MyBackup/*
mv $tempfile $bkfile
and I need that the variable are expanded.
Could anyone help me with this problem?