'sh file not found in linux command line

I'm an owner of synology's diskstation NAS server running on special OS (mainly linux)

It has only access from internet. I established command line interface to access it using synology wiki. Now I try to install Counter-Strike server on it using SteamCMD. I just look in Valve Developer Community for it.

I'm writing the next:

mkdir csServer  
cd csServer
wget http://media.steampowered.com/client/steamcmd_linux.tar.gz
tar xvfz steamcmd_linux.tar.gz
./steamcmd.sh

But the last line causes -sh: ./steamcmd.sh not found. However, I can see this file in the directory.

enter image description here

What actually can cause it?

//ADDED

The file is executable!

enter image description here



Solution 1:[1]

Your script contains a header which says #!/bin/bash, that is use /bin/bash to execute this script. Apparently, on your system /bin/bash is not present. I am not familiar with Synology environment, but you should be able to fix this problem by installing bash and then pointing your script to the right path, which should be /opt/bin/bash. The first line of your script should therefore look like the following

#!/opt/bin/bash

You could also use Synology default ash, but beware that you script might not work as it was written for bash.

Solution 2:[2]

Windows style end-of-lines (CRLF) can cause this issue. If your sh file contains Windows style end-of-lines, convert it to Linux style.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 assafp