Created
January 17, 2019 14:31
-
-
Save knuxify/3b4409077081a8665463f6e5cf18b455 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# drivelinker - short script to make symlinks of drives | |
# variables | |
refreshrate="5" # refresh rate in seconds | |
desktop="$HOME/Desktop" # user's desktop | |
mount="/run/media/$USER" # where the drives are mounted | |
while true; do | |
for link in $desktop/* | |
do | |
if ! [ -f $link ] && [ -L $link ]; then rm $link; fi | |
done | |
for drive in $mount/* | |
do | |
if ! [[ "$drive" = *"*" ]]; then | |
ln -s $drive $desktop/${drive/"$mount"/} | |
fi | |
done | |
sleep $refreshrate | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment