Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

linux check if a group exist or not

cat /etc/group | grep GROUP_NAME 1> /dev/null
echo $? #result 0 or 1

#or

if ! cat /etc/group | grep $1 1> /dev/null
then
	echo "Error! $1 doesn't exist!"
else
  	echo "$1 group exist!"
fi
Comment

PREVIOUS NEXT
Code Example
Shell :: grep line after match 
Shell :: linux cp 
Shell :: pip install cookiecutter 
Shell :: zip file linux 
Shell :: git commands to push to github 
Shell :: how to get process id in linux 
Shell :: gitlab push to create 
Shell :: linux change permissions recursive only directories 
Shell :: IntelliJ IDEA 4.2 
Shell :: delete a deployment in kubernetes 
Shell :: how to check wsl version 
Shell :: how to install pipenv 
Shell :: prettier npm 
Shell :: How can I check if a directory exists in a Bash shell script? 
Shell :: brew show package info 
Shell :: uninstall all pip packages 
Shell :: git rebase branch 
Shell :: git merge tag to branch and squash commits 
Shell :: failed to start high performance web server and reverse proxy 
Shell :: microphone auto adjusting ubuntu 
Shell :: Start MySQL FreeBSD 
Shell :: .gitignore everything except 
Shell :: how to move folders in linux terminal 
Shell :: conda install spyder 4.2.5 
Shell :: how to check ip addres on manjero 
Shell :: git checkout filename 
Shell :: remove image docker 
Shell :: opencart install extension Invalid file type! 
Shell :: Show Commit Log as Graph For Current or All Branches in git command 
Shell :: grep substring in shell 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =