I kind of do not know what is a part of the script and what not. You should use the Code tags to show the script (e.g. the $ fx-permiss.sh line is not in your script I hope.)
for user in $1 $2 $3
, you should use
for user in "$@"
, which is equivalen to
Inside the loop, do not use $1, use $user. You do not have to shift
if you do not use $1, $2 etc.
If you want to run the second part only if there was no argument, you should make it clear to the shell as well, so add something like
if (( ! $# )) ; then ... fi
You are probably running this script as root (otherwise, you would not be able to set other users' permissions), so a good place to store the resulting file is your home (usually /root).