I created a two backup scripts - one for files (filebackup.sh) and another for database (dbbackup.sh).
dbbackup.sh and stores the output in a variable. The output returned by
dbbackup.sh is the tar filename in which the script has stored all the backed up databases.
dbbackup.sh contains the following at the end:
echo $TARFILE > /dev/tty
filebackup.sh calls dbbackup.sh like this:
This dumps all extra output from the script to /dev/null and ensures only the filename is returned.
Everything works except when I call filebackup.sh, the filename is printed to screen. The variable
$DBBACKUP remains empty. What am I doing wrong here?