#!/bin/bash while getopts n:a: OPT do case "${OPT}" in n) name=${OPTARG};; a) age=${OPTARG};; *) echo "Invalid option" exit 1;; esac done printf "My name is $name and I am $age years old\n"
#!/bin/bash while getopts n:a: OPT do case "${OPT}" in n) name=${OPTARG};; a) age=${OPTARG};; *) echo "Invalid option" exit 1;; esac done printf "My name is $name and I am $age years old\n"