bash if user exists in a group then add
egrep -i "^groupname" /etc/group;
if [ $? -eq 0 ]; then
echo "Group Exists"
else
echo "Group does not exist -- Invalid Group name"
fi
#!/bin/bash
# init
USERID="$1"
#....
/bin/egrep -i "^${USERID}:" /etc/passwd
if [ $? -eq 0 ]; then
echo "User $USERID exists in /etc/passwd"
else
echo "User $USERID does not exists in /etc/passwd"
fi
# ....egrep -i "^useraccount:" /etc/passwd;
if [ $? -eq 0 ]; then
echo "User Exists"
else
echo "User does not exist -- Invalid Username"
fi
Also in C++:
- how to check spark version
- fuser install linux
- how to check free space in linux
- screen linux terminal
- how to merge two repositories in github
- echo time bash mac
- No module named notebook
- ubuntu install gerrit
- src refspec master does not match any
- git pull from another user
- linux ogg to wav
- git update branch from master
- installing git on ec2
- bash count number of arguments
- how to make ubuntu faster
- INSTALL - pub/scm/git/git.git - Git at Google"
- chromium for linux
- git revert file to master
- xargs curl url
- accept only numbers regex
- bluetooth xubuntu activate linux
- nginx certbot ubuntu
- how to install bootstrap in angular 10
- configure github account ubuntu