I
I
Ivan Vasilich2016-10-05 11:56:43
bash
Ivan Vasilich, 2016-10-05 11:56:43

Bash script for console swift, compilation automation how to write?

Good day or evening/night to all.
In general, I have a script or its beginning.
I'm either dumb or my poppy is hard buggy.
In general, the simplest option is

#!/bin/bash
#
#
#

echo Please, enter your name

read NAME

echo "Hi $NAME!"

When using ./buildSwift.sh
./buildSwift.sh
-bash: ./buildSwift.sh: /bin/bash^M: bad interpreter: No such file or directory
when using sh buildSwift.sh
sh buildSwift.sh
: command not found 5:
Please, enter your name
: command not found 7:
user
': not a valid identifierad: `NAME
: command not found 9:
Hi !
The same thing if I try like this bash buildSwift.sh
what the hell is going on with me
I wanted to write a script that would compile the project in swift, but at the same time delete the previous terminal result

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RPG, 2016-10-05
@jcmax

What text editor? Enable line break UNIX in it, these errors are typical for invisible special characters (carriage return) getting into the source code, editors on Windows are especially guilty. Open it in vim and see these ^M:)
dos2unix - there is such a utility - convert curved line breaks.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question