#!/bin/bash #Get all the Disk IT by ID, Label. Path and UID #set -x #{{{ Parameters . /home/default #}}} #{{{ The actual listing FILTER () { ID="/dev/disk/by-${id}/" LINE "${txtbld}${txtcyn}Disk by ${ID}${txtoff}" ls -l $ID|awk '{print $NF "'" = $ID${txtcyn}"'" $9 "'"${txtoff}"'"}' | \ column -t|/bin/egrep -v 'edd|part|ata|^0'|sort|sed 's#../../#/dev/#g' } HELP () { echo "Usage: $0 or with -iplu or any letter combination seperate." } #}}} #{{{ Selection #{{{ No Selection means all if [ -z "$1" ] then for id in id label path uuid do FILTER done exit 0 fi #}}} #{{{ Selection with options PARAMETER=`getopt -o ipluh -n $BASENAME -- "$@"` eval set -- "$PARAMETER" while true do case "$1" in -h) HELP; exit 1 ;; -i) id=id ; FILTER ; shift ;; -p) id=path ; FILTER ; shift ;; -l) id=label ; FILTER ; shift ;; -u) id=uuid ; FILTER ; shift ;; --) shift ; break ;; *) LINE "Internal error!" ; exit 1 ;; esac done #}}}#}}}