# restricted ssh does not allow arguments, but they exist in this env variable.
# The var comes with a leading space, remove it.
-args="${SSH_ORIGINAL_COMMAND#* }"
+args="${SSH_ORIGINAL_COMMAND# }"
if [[ ! $args =~ $regex ]]; then
echo "error: bad argument. args=$args" >&2; exit 1
fi
-arg1="${args%% *}"
+IFS=" " read -r -a arg_array <<<"$args"
+
+
+arg1="${arg_array[0]}"
case "$arg1" in
list)
;;
esac
-# just 2 args, so split the space.
-arg2="${args## *}"
+arg2="${arg_array[1]}"
case "$arg2" in