I need to rename a directory in a crontab job so created bash file to run the script that that will move the folder prior to running mongodump command.
When I run the command directory on the command line the directory is moved and renamed without any extra characters
When I run the move.sh that directory is moved but with an trailing ?
at the end of the directory name. Rm -R /change071105^M
also appear..
Any insight is appreciated
Checked move.sh for extra character.
Directory was renamed and all files appeared.
Created a move.sh with:
Resume of mv
in script renames directory as:
change071105?
not the expected change071115
Ran command at the command line to confirm
mv /mongo_backup/change /mongo_backup/change$(date --date='1 day ago' +'%m%d%y')
also checked move.sh for extra spaces ..
#!/bin/bash
dd=$(date --date='1 day ago' +'%m%d%y')
mv -v "/mongo_backup/change" "/mongo_backup/change$dd"
#mv /mongo_backup/change /mongo_backup/change$(date --date='1 day ago' +'%m%d%y')