Skip to content

Commit

Permalink
Update Task 101
Browse files Browse the repository at this point in the history
  • Loading branch information
yeungegs committed Jun 13, 2017
1 parent 32fdb68 commit a2c78fe
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions 0x04-loops_conditions_and_parsing/101-tell_the_story_of_passwd
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
#!/usr/bin/env bash
# this script displays the content of the file /etc/password, using the while loop + IFS.

while read -r line; do
USERNAME="$(echo "$line" | cut -d':' -f1)"
GID="$(echo "$line" | cut -d':' -f4)"
HOME="$(echo "$line" | cut -d':' -f6)"
CMD="$(echo "$line" | cut -d':' -f7)"
USID="$(echo "$line" | cut -d':' -f3)"
PASSWD="$(echo "$line" | cut -d':' -f2)"
INFO="$(echo "$line" | cut -d':' -f5)"
echo "The user $USERNAME is part of the $GID gang, lives in $HOME and rides $CMD. $USID's place is protected by the passcode $PASSWD, more info about the user here: $INFO"
while IFS=":" read -r f1 f2 f3 f4 f5 f6 f7; do
echo "The user $f1 is part of the $f4 gang, lives in $f6 and rides $f7. $f3's place is protected by the passcode $f2, more info about the user here: $f5"
done < /etc/passwd

0 comments on commit a2c78fe

Please sign in to comment.