Run following command in terminal
sed -i -e 's/\r$//' scriptname.sh
Then try
./scriptname.sh
It should work.
More Related Contents:
- Echo newline in Bash prints literal \n
- Why would a correct shell script give a wrapped/truncated/corrupted error message? [duplicate]
- ‘\r’: command not found – .bashrc / .bash_profile [duplicate]
- What are carriage return, linefeed, and form feed?
- How to avoid bash command substitution to remove the newline character?
- Bash: Strip trailing linebreak from output
- Convert DOS/Windows line endings to Linux line endings in Vim
- What does the ^M character mean in Vim?
- What is the difference between a “line feed” and a “carriage return”?
- Anything like dos2unix for Windows?
- Removing carriage return and linefeed from the end of a string in C#
- How to give a pattern for new line in grep?
- How to use `while read` (Bash) to read the last line in a file if there’s no newline at the end of the file?
- How to add a newline (line break) in an XML file?
- Why should there be spaces around ‘[‘ and ‘]’ in Bash?
- Capturing multiple line output into a Bash variable
- Bash tool to get nth line from a file
- Using variables inside a bash heredoc
- How can I exclude all “permission denied” messages from “find”?
- How to get a password from a shell script without echoing
- Exit Shell Script Based on Process Exit Code [duplicate]
- How do I pass in the asterisk character ‘*’ in bash as arguments to my C program?
- Remove Unicode characters from textfiles – sed , other Bash/shell methods
- How to replace an entire line in a text file by line number
- Using case for a range of numbers in Bash
- How to run some command before or after every Bash command entered from console?
- Docker: How to use bash with an Alpine based docker image?
- How to get the list of files in a directory in a shell script?
- VSCode Integrated Terminal Doesn’t Load .bashrc or .bash_profile
- Preserving leading white space while reading>>writing a file line by line in bash