Fix arg processing bug
This commit is contained in:
16
runas.sh
16
runas.sh
@@ -12,13 +12,10 @@ function ts {
|
|||||||
#-----------------------------------------------------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function process_args {
|
function process_args {
|
||||||
# Shift off the args as we go so that we can exec $@ later. These are meant to be globals.
|
# These are meant to be globals.
|
||||||
UMAP=$1
|
UMAP=$1
|
||||||
shift
|
GMAP=$2
|
||||||
GMAP=$1
|
UGID=$3
|
||||||
shift
|
|
||||||
UGID=$1
|
|
||||||
shift
|
|
||||||
|
|
||||||
for NAME_UID_GID in $UMAP
|
for NAME_UID_GID in $UMAP
|
||||||
do
|
do
|
||||||
@@ -40,7 +37,7 @@ function process_args {
|
|||||||
|
|
||||||
if [[ ! "$UGID" =~ ^[0-9]{1,}:[0-9]{1,}$ ]]
|
if [[ ! "$UGID" =~ ^[0-9]{1,}:[0-9]{1,}$ ]]
|
||||||
then
|
then
|
||||||
echo "UGID value is not valid. It should be of the form <uid>:<gid>"
|
echo "UGID value $UGID is not valid. It should be of the form <uid>:<gid>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -103,7 +100,10 @@ function create_user {
|
|||||||
|
|
||||||
#-----------------------------------------------------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
process_args
|
process_args "$@"
|
||||||
|
|
||||||
|
# Shift off the args so that we can exec $@ below
|
||||||
|
shift; shift; shift
|
||||||
|
|
||||||
update_users "$UMAP"
|
update_users "$UMAP"
|
||||||
update_groups "$GMAP"
|
update_groups "$GMAP"
|
||||||
|
|||||||
Reference in New Issue
Block a user