I want to have filenames with date appended for backup. The error msg is,
test.sh: line 7: ${f}-backup-${date +”%b %e”}.gz: bad substitution
what is wrong? Thanks.
FILES=/home/raja/test/*
for f in $FILES
do
echo ${f}-backup-${date +"%b %e"}.gz
done
You want to write
$(date +"%b %e"). Parenthesis instead of curly braces.The difference is that
$(...)creates a subshell which executes..., while${...}is expanded to the value of....