I have a bash script that edits two tags in a yaml file and these values are passed as parameters. How can I change the script for a scenario where only one tag has to be updated
#!/bin/bash
#Update UI-ImageTag
sed -i -e '/APP:/{n;n;s/\(imageTag\).*/\1: "'"app-ui-$1"'" /}' \
-e '/APP:/{n;n;n;n;s/\(imageTag\).*/\1: "'"app-db-$2"'" /}' \
values.yaml
While running the script and passing values for parameters $1 and $2 Ex(./script.sh 1.0 2.0) both the tags are updated in the values.yaml file, but when I give value for only one parameter and leave the other one empty(i.e., execute the script by passing value for $1 only), then the $2 tag in values.yaml file is replaced with an empty value. How to change the script so that in a scenario where I dont need to change the tag of app-db and if I dont pass a value for $2, it keeps the old value in the yaml file unchanged