I am new to Bash Script. I run the following simple script in Ubuntu like this:
sudo bash -x Script.sh
Output:
+ $'\r'
: command not found
+ $'\r'
: command not found
+ $'\r'
: command not found
+ adminEmail=$'info@domain.com\r'
+ $'\r'
: command not found
' echo 'database name:
database name:
+ read $'dbname\r'
The actual script:
#!/bin/bash
# Installation script for latest WordPress website on Ubuntu
#
# Kave
# December 27, 2011
adminEmail="info@domain.com"
echo "database name:"
read dbname
What are all these '\r' error messages coming up? Even the comments seem not to be understood…
You downloaded the file via a Windows machine, and you have CRLF line endings (that’s
\r\nin C and related languages).Remove the DOS line endings. For example, edit the file in
vimand change the format with:set fileformat=unix(plus Return) and then write the file back out. Alternative techniques could use thetrcommand, ordos2unixordtou, depending on what’s available.