I am creating a bash script to create backups, however the bash scripts mkdir is naming the folder with some sort of special characters on the end. if I ls the directory the name show up with a ? on the end which I know is terminals way of showing unrecognized special characters.
How do I get my bash script to to create the folder without adding on this special unrecognized character to the end.
Any help is appreciated.
See script below:
#!/bin/bash
mkdir -p "/var/backups/Backup"
mysqldump -u user1 -ptest DB tbl1 > "/var/backups/Backup/tbl1.sql"
DAY=$(date +%Y%m%d%H%M%S)
zip -r /var/backups/bkup-$DAY.zip /var/backups/Backup
cat -A shows the following:
#!/bin/bash^M$
mkdir -p "/var/backups/Backup"^M$
mysqldump -u user1 -ptest DB tbl1 > "/var/backups/Backup/tbl1.sql"^M$
DAY=$(date +%Y%m%d%H%M%S)^M$
zip -r /var/backups/bkup-$DAY.zip /var/backups/Backup
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…