Retreiving multiple flags of an argument using getopts in Bash

Viewed 21

I need help with getopts multiflags.

I want to create a Bash script which is going to perform two below given tasks and save to my config file. Handling multi flags is an issue for me here.

  • Add an ssh connection

$ ./otssh -a -n server1 -h server_ip_here -u wanda

  • Update previous ssh connection

$ ./otssh -u -n server1 -h server_ip_here -u thor

My config file will look like this after add and update script runs

enter image description here Any help?

0 Answers
Related