SHARE
TWEET

Untitled

a guest Apr 21st, 2018 76 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=$'\n'
  8. garbage=0
  9. for entry in `cat /etc/passwd`
  10. do
  11.    echo "Value in $entry -"
  12.    IFS=:
  13.    for value in $entry
  14.    do
  15.     let $garbage += 1
  16.     if [$garbage -eq 1] then
  17.             echo "   username: $value"
  18.     elif [$garbage -eq 2] then
  19.             echo "   password: $value"
  20.     elif [$garbage -eq 3] then
  21.             echo "   UID: $value"
  22.     elif [$garbage -eq 4] then
  23.             echo "   GID: $value"
  24.     elif [$garbage -eq 5] then
  25.             echo "   realname: $value"
  26.     elif [$garbage -eq 6] then
  27.             echo "   homedir: $value"
  28.     elif [$garbage -eq 7] then
  29.             echo "   shell: $value"
  30.     fi
  31.  
  32.    done
  33.    let $garbage = 0
  34. 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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top