# add new user to local node with specified uid and passwd by reading the content from /share/apps/configrepo/users_data/newuser.dat /share/apps/local/bin/coc-check_user_local username=$(cat /share/apps/configrepo/users_data/newuser.dat | awk '{print $2}') uid=$(cat /share/apps/configrepo/users_data/newuser.dat | awk '{print $3}') passwd=$(cat /share/apps/configrepo/users_data/newuser.dat | awk '{print $4}') #echo 'passwd=' $passwd if [ "$(cat /share/apps/configrepo/users_data/addstatus.dat)" = 'yes' ] then useradd -u $uid -g users -s /bin/bash -p $(echo "$passwd" | openssl passwd -1 -stdin) $username gen_bashrc.txt echo 'user' $username ' with uid' $uid 'has been added to /etc/passwd' in $HOSTNAME else echo 'user' $username 'already existed or uid' $uid 'is not uniq in /etc/passwd'. Not adding the user $username to $HOSTNAME fi