0

I tried this and failed. Does case statements exist in termux?

#!/data/data/com.termux/files/usr/bin/bash
case in "$1"
    start)
            echo 'var1'
            ;;
    stop)
            echo 'var2'
            ;;
esac

1 Answer 1

2

Termux does indeed support case, but your syntax is incorrect. This, instead, works.

case "$1" in
 start)
  echo 'var1'
  ;;

 stop)
  echo 'var2'
  ;;
esac

Adding a blank line between the start) and stop) blocks is just a stylistic choice.

2
  • Tnx. Got it. Where I can generally investigate about termux borders: what is supported and what - not. Commented Feb 15, 2018 at 7:49
  • 2
    @JosefKlimuk Being Termux's default shell Bash, you can assume that all of the builtins and shell commands you would be able to call during a Bash session on a Linux machine be working. If what concerns you are what packages are able to be installed, either see the project's homepage, or directly ask its author, which maintains said packages.
    – Grimoire
    Commented Feb 15, 2018 at 12:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .