Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #created by Kris Occhipinti
- #http://filmsbykris.com
- #Thu Apr 7 12:44:27 EDT 2016
- #GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
- #source code http://pastebin.com/CGaDFjcc
- #colors
- blink=`echo -en "\e[5m"`
- RED=`echo -en "\e[41m"`
- bold=`echo -en "\e[1m"`
- DEFAULT=`echo -en "\e[49m"`
- cat << EOF
- This script will detect a new USB drive.
- Please make sure that the drive is not plugged in
- and press <ENTER> when ready.
- EOF
- read
- echo "Please plug the drive in and press <ENTER> when ready"
- read
- echo "Checking for a new USB Drive"
- sleep 1
- #Check for new USB drives added in the last minute
- id="$(find /dev/disk/by-id/usb* -mmin -1 -print|grep -v 'part')"
- let count=$(find /dev/disk/by-id/usb* -mmin -1 -print|grep -v 'part'|wc -l)
- if [ "$count" -gt 1 ]
- then
- echo "${RED}${blink}${bold}"
- echo 'WARNING!!! More then one Drive detected!!!'
- echo "${DEFAULT}"
- echo "$id"
- elif [ "$count" -eq 0 ]
- then
- echo "${RED}${blink}${bold}"
- echo 'WARNING!!! No New Drives Detected!!!'
- echo "${DEFAULT}"
- else
- echo "$id detected at:"
- readlink -f $id
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement