Advertisement
MadCortez

lab1

Feb 26th, 2022
1,088
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.37 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. NOWDIR=`pwd`
  4.  
  5. PROCNAME="$1"
  6. PROCPID=`pidof "$PROCNAME"`
  7. echo "$PROCPID"
  8. IFS=' ' read -ra my_array <<< "$PROCPID"
  9. cd /
  10. cd proc/
  11. for i in "${my_array[@]}"
  12. do
  13.     #echo "$i"
  14.     cd "$i"/fd
  15.     echo NAME = "$PROCNAME" "|" PID = "$i" "|" FILES = `ls | wc -l`
  16.     cd ../../
  17. done
  18. #echo NAME = "$PROCNAME" "|" PID = "$PROCPID" "|" FILES = `ls | wc -l`
  19. cd ~
  20. #cd "$NOWDIR"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement