I am creating a script that needs to generate commit messages based on timestamps for automatic backups in a private repository.
echo "#!/bin/bash
cd ${DIRECTORY}
git add .
git commit -m 'Backup $(date +%s)'
git push origin master
" >> backup.sh
The timestamp $(date +%s)
variable must be printed as is in the file instead of printing the timestamp when this file is generated.
How do I pass the actual variable to the text file in bash?
I have tried back ticks and it prints nothing. Maybe I am trying it wrong?