R
R
Roma Antonyuk2017-10-11 13:08:16
bash
Roma Antonyuk, 2017-10-11 13:08:16

How to solve problem with deleting zip file via shell script?

There is a written script

#!/bin/bash
mysqldump -u USER -p"PASSWORD" ps > /var/local/databases-backups/ps-$(date +"%d-%m-%Y").sql
zip /var/local/databases-backups/ps-$(date +"%d-%m-%Y").zip /var/local/databases-backups/ps-$(date +"%d-%m-%Y").sql
rm /var/local/databases-backups/ps-$(date +"%d-%m-%Y").sql
#use aws (Amazon's tool) to sync your backups to Amazon S3
/usr/bin/aws s3 sync /var/local/databases-backups s3://apstay2017/Databases/ > /root/aws.log
rm /var/local/databases-backups/ps-$(date +"%d-%m-%Y").zip

Error: "cannot remove '/var/local/databases-backups/ps-11-10-2017.zip'$'\r': No such file or directory"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Q
qlkvg, 2017-10-11
@smilik96

sudo apt install dos2unix
dos2unix <script_name>

A
AVKor, 2017-10-11
@AVKor

First, here's the use in teams several times: a
bummer can occur.
Secondly, in the text of the error everything is written:
Such a file:

/var/local/databases-backups/ps-11-10-2017.zip'$'\r'
no, there is, presumably, such: /var/local/databases-backups/ps-11-10-2017.zip.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question