Save user names on .txt file witch username is listed in /etc/passwd file. Bash
- by user1448637
well my goal is to make bash script to check if the username exist in /etc/passwd, if true i want to add it to the users.txt file.
i am not really good at UNIX programming so i hope somebody 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 folowing string "argv[0]=agrv[1]"
else
"error message"