You can convert line endings of your script to UNIX format using a utility like dos2unix
.
-
Install
dos2unix
if it’s not already available on your system. You can use the package manager for your Linux distribution to install it. -
Open a terminal and navigate to the directory where your script is located.
-
Run the following command to convert the line endings of your script to UNIX format:
dos2unix some_bash_script.sh
-
After the conversion, try running the script again:
./some_bash_script.sh
Alternatively, if you don’t have access to dos2unix
or prefer not to use it, you can try manually converting the line endings using a text editor that supports the conversion. Save the file with UNIX-style line endings and then try running the script again.