daily pastebin goal
53%
SHARE
TWEET

Untitled

a guest Apr 21st, 2018 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ##
  2. ## Broken Script
  3. ##
  4. #!/bin/bash
  5. # changing IFS value
  6.  
  7. IFS.OLD=$IFS
  8. IFS=$'\n'
  9. garbage=0
  10. for entry in `cat /etc/passwd`
  11. do
  12.    echo "Value in $entry -"
  13.    IFS=:
  14.    for value in $entry
  15.    do
  16.     let garbage += 1
  17.     if garbage = 1 then
  18.             echo "   username: $value"
  19.     elif garbage = 2 then
  20.             echo "   password: $value"
  21.     elif garbage = 3 then
  22.             echo "   UID: $value"
  23.     elif garbage = 4 then
  24.             echo "   GID: $value"
  25.     elif garbage = 5 then
  26.             echo "   realname: $value"
  27.     elif garbage = 6 then
  28.             echo "   homedir: $value"
  29.     elif garbage = 7 then
  30.             echo "   shell: $value"
  31.     fi
  32.  
  33.    done
  34.    let garbage = 0
  35. done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top