0

just playing around on my server to get script the setup of the next server. Everything works - now I want to run it on the new server i got an error like this:

sudo sh setup.sh Hostname is dinozzo setup.sh: 10: setup.sh: [[: not found

The Script to start is not that much. Line 10 is

if [[ "$INT_DEV_HOSTNAME" ]]; then

But I don't get it why it is not working on Ubuntu 14.04.5 LTS.

2
  • The question was already answered here stackoverflow.com/questions/3601515/… Commented Oct 21, 2016 at 14:06
  • 2
    sh is not the same as bash. [[ is a bash-ism -- so execute the script with bash instead. Commented Oct 21, 2016 at 14:06

1 Answer 1

3

You explicetly tell the shell to use sh :

sudo sh setup.sh Hostname is dinozzo setup.sh: 10: setup.sh: [[: not found 

In this mode, even if it's that you are using by default, it will produce the error because it will be in POSIX mode.

[[ ]] form of test need to be called from within a shell (other shells support it too, like ksh, zsh...)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.