Have you ever wondered to input the arguments in the bash scripts. Well there is the process how you do it.
Step 1: add the following script on the top of bash script file (test.sh)
# passing the arguments
while [ $# -gt 0 ]; do
if [[ $1 == *”–“* ]]; then
echo $appName $version # this one is passed as an arguments
Step 2: pass the name of variable that you want to access in as an arguments something like this
./test.sh –-appName App1 –-version v1.2
What a great way isn’t it?