Today, while working I found a very strange error coming while trying to execute a Linux script. The error what I was getting said that script does not exits although, I was able to edit it using the vi editor.
After a long search found that the Linux was not able to read the file. as it was copied/ developed on a windows machine. So, there a very simple solution to this problem.
We have a package available i.e. dos2unix which can be installed on any flavor of Linux server and it can be used to convert the files into Linux readable files. Given below are the commands that we can use to install dos2unix
sudo yum install dos2unix -y
After we have installed dos2unix package we can execute a very simple command to convert the file so that unix system can easily interpret it or execute it.
Here file.sh is the file that needs to be converted to unix based file system.