簡體   English   中英

$'\\ r':找不到命令(Ubuntu 13.04)

[英]$'\r': command not found (Ubuntu 13.04)

使用此腳本的問題: Ubuntu給出以下錯誤$'\\ r':找不到命令

#what to backup
backup_files="/home/minecraft/multicraft/jar"

#where to backup to
dest="/"

#create archive filename
day=$(date +%F)
#hostname=$(Set a hostname)
archive_file=$day.tgz

#print start status mesage
echo "Backing up $backup_files to $dest/$archive_file"
date
echo 

#backup the files using tar
tar czf $dest/$archive_file $backup_files

#print end status message
echo 
echo 
echo "Backup finished"
date

#listing the files in $dest to check file sizes
echo "The Destination Path:"
ls -lah $dest

是什么導致此錯誤,有沒有簡單的解決方法?

您的空白行實際上不是空白,因為您的行末尾有錯誤。 在文件上嘗試使用dos2unixd2u來修復行尾。

嘗試使用dos2unix命令以正確的格式轉換文件。

示例:dos2unix testfile.sh

然后再次運行。 它應該工作。

http://ctrlaltsolve.blogspot.in

Notepad ++可以解決此問題,不需要額外的dos2unix應用程序。 我在這里回答: '\\ r':找不到命令

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM