getopts empty argument and default value
my requirement is really simple, I just want to check that if the getopts argument is empty or not. I am kicking my script using the jenkins and need to check that if the provided value is empty then set the default otherwise use the provided value: and passing the arguments to the shell script like this: ./rds-db-dump.sh -s ${source_instance_id} -c ${target_instance_class} -i ${source_snapshot_id} snippet from shell script: while getopts ":s:c:i:h" opt; do case ${opt} in s) SOURCE_INSTANCE_ID="${OPTARG}" ;; c) TARGET_INSTANCE_CLASS="${OPTARG}" ;; i) SOURCE_SNAPSHOT_ID="${OPTARG}" ;; h) usage
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.