This is an error I encountered when playing with Getopts. The following is the code snippet I have been playing simply listen to 3 options when executing a script.
while getopts "vcn" opt; do
case $opt in
v) echo "Print V" ;;
c) echo "Print C" ;;
n) echo "Print N" ;;
*) echo "Invalid Option" && exit 1 ;;
esac
done
I'm not sure Why I'm getting the below error when executing this script even though I have handled errors with *) option to do so.
The error handle is working as shown in the picture below but after getting an unprogrammed error.

Asked by Dettlaff404
(3 rep)
Jan 7, 2024, 11:47 AM
Last activity: Jan 7, 2024, 07:21 PM
Last activity: Jan 7, 2024, 07:21 PM