Files
Makefile-tutorial/shell/getopts.sh
2025-02-23 15:43:13 +00:00

15 lines
361 B
Bash

#!/bin/bash
while getopts a:b:cd param;
do
case $param in
a) echo "parameter 'a' with argument: $OPTARG"
;;
b) echo "parameter 'b' selected with argument: $OPTARG"
;;
c) echo "parameter 'c' selected (no colon, no argument)"
;;
d) echo "parameter 'd' selected"
;;
esac
done