1

I was asked to create command which generates one word in terminal, if internet connection is absense, and another one, if it present. For doing that it seems that I need "if" and "else" syntaxis. Is it possible to provide such syntaxis in terminal?

muru
  • 197,895
  • 55
  • 485
  • 740
John Taylor
  • 147
  • 1
  • 1
  • 7

1 Answers1

11
$ if [ 'a' = 'b' ]; then echo 'Equal'; else echo 'Not equal'; fi
Not equal
$
Gunnar Hjalmarsson
  • 33,540
  • 3
  • 64
  • 94