Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Repopulate symlinks from udev rule
#!/usr/bin/env bash
# repopulate music links when drive plugged in
shopt -s nullglob
export DISPLAY=:0
export XAUTHORITY=/home/jason/.Xauthority
music=(/media/Apollo/Music/*)
find /home/jason/Music -type l -exec rm {} \;
for dirs in "${music[@]}"; do
ln -s "$dirs" /home/jason/Music/ 2>/dev/null
done
status1=$?
mpc update &>/dev/null
status2=$?
if [[ "$status1" -eq 0 && "$status2" -eq 0 ]]; then
printf "%s\n" "Music directory updated" | dzen2 -p 3
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment