Error in Linux running file: bash: $’\r’: command not found

Problem description

After the SH file is written in windows, an error will be reported when running in Linux: bash: $’\ R’: command not found


This is because the windows system uses - for file wrapping, while the UNIX system uses - for file wrapping


Method 1

Install dos2unix for file conversion

yum install -y dos2unix


Method 2

Use VIM to open the file, and then use the command: set FF = UNIX </ KBD>, save the file

# use vim to open file
# change formate
:set ff=unix
# save file

Read More: