I currently have a bash script in which I have hard coded certain variables, and I was hoping to be able to set these variables by passing arguments.
A simple example: consider the script example.sh where I have hard coded values for the variables data_names and run_this
#!/bin/bash
data_names=("apple_picking" "iris")
run_this="TRUE"
#remainder of script runs things using these hard coded variables
I am wondering if it is possible to edit this script so that:
I can set the values of
data_namesandrun_thisby passing arguments when I runbash example.shIf no arguments are passed for either
data_namesandrun_thisto the script, then the variables should take on default (hard coded) values.