Is it possible to use bash to fetch a string from an array provided in the following syntax within a config file?
| | Version | PackageManager | Webserver | Database | |--------|---------|----------------|-----------|----------| | Centos | 7 | yum | httpd | mariadb | | Ubuntu | 14.04 | apt-get | apache | mysql |
From within a bash script (bootstrap.sh) I want to be able to write a single line to install a package such as "./install.sh -webserver" to install either httpd or apache depending on the Server OS.
- From within bootstrap.sh I simply call ./install.sh -webserver" that holds the logic to check which is the current Server OS and if the Server OS is supported
- check what is to be installed (-webserver)
- looks into transform table to choose the right package manager and package name for the related OS
- and returns the command required (yum install httpd) within bootstrap.sh to install httpd
I know this looks weird but you help is much apprecaited.