I have a case script and need to input username in option -u user... how to type variable user to be able in this option list groups of specific typed user, thanks for help
#!/bin/bash
while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do case $1 in
-h | --help)
echo "usage=$(basename "$0")[-h][-g][-u user][-e]
-h [show help]
-g [show only primary group, otherwise all]
-u user [show groups of specific user, otherwise logged] user
exit
;;
-g | --primary)
shift;
echo "under work"
;;
-u $user | --user)
shift;
echo "$(groups user)"
;;
esac; shift; done
if [[ "$1" == '--' ]];then
shift;
fi