dotfiles/Utils/sldm.sh
2013-09-19 00:43:50 +02:00

28 lines
457 B
Bash
Executable file

#!/bin/bash
# sldm - Super Lightweight Device Mounter
#TODO: FIXME and make me nicer
devices=(/dev/sd??)
dontwant=sda
tomount=/media
for device in ${devices[@]}; do
last=$(echo $device | awk -F/ '{print $NF}')
if [ "${device#*$dontwant}" == "$device" ]; then
echo $device
mount | grep $device > /dev/null
if [ $? -ne 0 ]; then
echo "yop"
pa=$tomount/$last
mkdir -p $pa > /dev/null
mount $device $pa
fi;
echo $device
fi;
done;