Conversion to MySQL shell script execution error $’\ R’: command not found

Explain the function of static keyword and final keyword in Java in detail>>>

Problem description

A small shell script written a few days ago was used to test the automatic installation of MySQL. Today’s test runs, and then the following error appears:

$’\ R’: command not found


Problem analysis

Check the script, no problem, just empty lines. It is suggested that this error is not the code itself. It is suspected that it may be the coding format error. The script is edited under Linux to complete the test. Later, I made a simple modification, which was completed in the window, and then uploaded to the Linux server
note: the newline in win is carriage return + newline, that is, the newline in UNIX

Linux does not recognize “R” as carriage return character. If the script has carriage return character, it will cause problems in the execution of script coding


Dealing with problems

execute the dos2unix script name on Linux, and execute the script after conversion

Check the SH file for garbled code

cat -Amysql_ install_ binary5.6.16.sh

prompt to install without dos2unix command

[ [email protected] soft]# dos2unix mysql_ install_ binary5.6.16.sh

bash: dos2unix: command not found…

[ [email protected] soft]# yum -y install dos2unix

Execute dos2unix script name on Linux,

[ [email protected] soft]# dos2unix mysql_ install_ binary5.6.16.sh

dos2unix: converting file mysql_ install_ binary5.6.16.sh to Unix format …

and then execute the script


After the script is executed, MySQL goes directly to the login interface. Done

In learning, try to develop good habits slowly, code, test and update under Linux, etc


End

I’d like to share with you the problems in my work and study, hoping to be helpful to you

Reproduced in: https://blog.51cto.com/it3246/2097318

Similar Posts: