SHARE
TWEET

basz

a guest Dec 2nd, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /bin/bash
  2. #SO IS1 211A LAB07
  3. # Jakub Ogryzek
  4. #oj44443@zut.edu.pl
  5. a=$1
  6. if [ $a = "-p" ]
  7. then
  8.  
  9. katalogi=`ls -1 /proc | grep -xE "[0-9]+"`
  10. #katalogi=`ls /proc | grep -xE "[0-9]+"`
  11.  
  12. #echo $katalogi
  13. cd /proc
  14. for argument in $katalogi
  15. do
  16. #ls
  17. cd "$argument"
  18. pid=`cat status | grep '^Pid:' | cut -c 6-`
  19. ppid=`cat status | grep 'PPid:' | cut -c 7-`
  20. uid=`cat status | grep 'Uid:' | cut -c 6- | cut -f2 | id -un`
  21. name=`cat status | grep 'Name:' | cut -c 7-`
  22. #echo $pid $ppid $uid $name
  23. printf '%s\t%s\t%s\t%s\n' "$pid" "$ppid" "$uid" "$name"
  24. #echo
  25. cd /proc
  26. done
  27.  
  28.  
  29.  
  30. elif [ $a = "-u" ]
  31. then
  32.  
  33. echo "XD"
  34.  
  35. else
  36. echo "Nie ma takiego argumentu"
  37. fi
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