mardi 23 janvier 2018

Error in sh script, if statement gives unexpected end of file

I am not so familiar with Linux and shell script, anyhow I tried out some command that I want to add to my start script but ran in to some problems.

I have tried in different ways to get rid of the

: unexpected end of file" 

and

 command not found

in this

#!/bin/bash
DEBUG="$1"
if [ "$DEBUG" = "debug" ]; then
echo "Lets start in debug mode"
fi

And I trie to run it from command line ike this

# sh myscript.sh debug

Have also tried to alter the if like this

if [ "$DEBUG" = "debug" ]
 then
  echo ......

but the error remains I know I can run it like this but it does not metter it seems

 ./myscript.sh debug

A hint or tip is most appreciated !! :)

Aucun commentaire:

Enregistrer un commentaire