I want to create a Bash Script to check the existence of a user name in /etc/passwd
. If it exists then add it to users.txt
file.
I am not really good at UNIX programming, so I hope somebody can help me.
while(get to the end of /etc/passwd){
name=$(cat /etc/passwd | cut -d: -f1);
num1=$(cat /etc/passwd | cut -d: -f3);
num2=$(cat /etc/passwd | cut -d: -f4);
if(num1==num2)
/*i compare argv[0] with $name */
/* if true i=1 */
}
if(i==1)
save following string "argv[0]=agrv[1]"
else
"error message"