Skip to main content
3 of 3
Formatting
AdminBee
  • 23.6k
  • 25
  • 55
  • 77

How to build hidden features in shell scripting, which are activated by user input using flags?

I want to build an extra feature in my script, which only runs if the user tells it to.

E.g. I have the program tree.sh which takes a gene input. E.g.

./tree.sh AIFM1

But I want to have an extra feature that visualises the gene.

I want to use flags to trigger the extra features in the shell script. I found this in the link: https://jonalmeida.com/posts/2013/05/26/different-ways-to-implement-flags-in-bash/. I would like to use flags, however the first argument is to search for something in a website (which could pretty much be anything). Meaning I need the use of cases, but one of the cases needs to account for anything else that wasn't specified in the cases. (e.g. like an else statement). How do I resolve this issue, without importing any special packages?

Jerry
  • 161
  • 1
  • 2
  • 9