I am new in windows 10 and Bash on Ubuntu and not familiar with shell script . I have to run this shell script
#!/bin/bash -x
mkdir -p lib
mkdir -p bin
cd nnforge
make $@
cd plain
make $@
cd ../cuda
make $@
cd ../..
cd examples
for i in ./*
do
if [ -d "$i" ];then
cd $i
make $@
cd ..
fi
done
cd ..
cd apps
for i in ./*
do
if [ -d "$i" ];then
cd $i
make $@
cd ..
fi
done
cd ..
But when I run this script with Bash, this show this errors
+ mkdir -p $'lib\r'
mkdir: cannot create directory ‘lib\r’: No such file or directory
+ mkdir -p $'bin\r'
mkdir: cannot create directory ‘bin\r’: No such file or directory
+ cd $'nnforge\r'
: No such file or directorynnforge
+ make $'\r'
./make_all.sh: line 5: make: command not found
+ cd $'plain\r'
: No such file or directoryplain
+ make $'\r'
./make_all.sh: line 7: make: command not found
+ cd $'../cuda\r'
: No such file or directory../cuda
+ make $'\r'
./make_all.sh: line 9: make: command not found
+ cd $'../..\r'
: No such file or directory ../..
+ cd $'examples\r'
: No such file or directory examples
./make_all.sh: line 13: syntax error near unexpected token `$'do\r''
'/make_all.sh: line 13: `do
How can I fix this and run script properly?