Another possible solution using unix text editor vi:
open file in vi edit with vi filename.sh command;
type in vi :set ff=unix command;
save file with :wq
It will save the file with unix line endings.
редактировал в блокноте в винде
а с помощью этой команды :set ff=unix перевел в unix формат и все заработало