Repopulate symlinks from udev rule
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
#!/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