# RHCSA 3.2: Loops Looping over the lines of a file, over files, over fields of `/etc/passwd`, and over arguments. ## Before you start The lab writes `/root/users.txt`: one user name per line, with some blank lines, and one name (`dora`) that already exists. Write each script where its task says and make it executable; the checks run them. ## Tasks 1. Write `/usr/local/bin/mkusers` that creates a user for each name in `/root/users.txt`, skipping users who already exist, and run it. Running it again must create no duplicates and print no errors other than "already exists". 2. Write `/usr/local/bin/bigfiles` that prints the name and size in bytes (`NAME SIZE`, one per line) of every regular file directly in `/etc` larger than 10000 bytes. Symbolic links don't count. 3. Write `/usr/local/bin/regular-users`: a loop that prints the login name and home directory (`NAME HOME`) of every user with a UID of 1000 or more, from `/etc/passwd`. 4. Write `/usr/local/bin/updown` that pings each host name given as an argument and prints `NAME up` or `NAME down` for each. ## Hints - `while read -r name; do ...; done /dev/null 2>&1`.