ubbyba

Untitled

Oct 20th, 2022
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.42 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. currentUser=$(/bin/ls -la /dev/console | /usr/bin/cut -d' ' -f4)
  4.  
  5. # Makes sure a user is logged in
  6. if [[ "${currentUser}" != "" && "${currentUser}" != "root" ]]; then
  7.     echo "${currentUser}"
  8.     su - "${currentUser}" -c 'read -r q _ < <(/usr/bin/brctl quota); [ -n "$q" ] || exit 0; f=$(echo "scale=2; $q/1024^3" | /usr/bin/bc -l); echo "$f GB"'
  9. else
  10.     echo 'No logged-in user detected.'
  11.     exit 1
  12. fi
Advertisement
Add Comment
Please, Sign In to add comment