Advertisement
OldManRiver

drive-size.sh

Jun 5th, 2014
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  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. FD="`fdisk -l | grep -i disk | grep -i media`";
  9. DI="`df -h`";
  10. DM="`dmesg | grep -i 'scsi' | grep -i sd`";
  11.  
  12. # Parse the DMESG cmd for Drive location and set VAR SDDRV
  13. echo ${DM};
  14.  
  15. # Parse the FDISK cmd for Drive Name and Size using ${SDDRV}
  16. #echo ${FD} | od -bc;
  17. echo ${FD};
  18.  
  19. # Parse the DF cmd for the Drive available space and mount point using ${SDDRV}
  20. echo ${DI};
  21.  
  22. exit 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement