Advertisement
OldManRiver

drive-size.sh

Jun 5th, 2014
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /bin/bash
  2. # Author: Nyle Davis Created 14-06-04
  3. # Purpose: Get Size of any/all USB Flash drives.
  4. # Return: VAR containing 1.) Drive Name, 2.) Drive Size
  5. # 3.) Space Available, 4.) Mount Point
  6. # File: drive-size.sh
  7.  
  8. DM="`dmesg | grep -i 'scsi' | grep -i removable`";
  9. FD="`fdisk -l | grep -i disk | grep -i media`";
  10. DI="`df -h`";
  11.  
  12. # Parse the DMESG cmd for Drive location and set VAR SDDRV
  13. echo "DM => " ${DM};
  14.  
  15. # Parse the FDISK cmd for Drive Name and Size using ${SDDRV}
  16. #echo ${FD} | od -bc;
  17. echo "FD => " ${FD};
  18. #while true; do sudo ${DM}; done\
  19.  
  20. # Get Flash name based on size value
  21.  
  22. # Parse the DF cmd for the Drive available space and mount point using ${SDDRV}
  23. echo "DI => " ${DI};
  24.  
  25. exit 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement