--- sound.orig 2004-02-13 16:15:51 +0300 +++ sound.orig 2004-02-13 16:21:05 +0300 @@ -42,6 +42,14 @@ ALSACTL= [ -x /usr/sbin/alsactl ] && ALSACTL=/usr/sbin/alsactl +# Remove duplicate lines from unsorted input +unique() +{ + awk '{ if (data[$0]++ == 0) + print + }' +} + LookupDevices() { egrep -qs '(sparcaudio|sound)' /proc/devices @@ -51,7 +59,7 @@ { local phrase=$1 pattern=$2 m opt= [ -n "$3" ] && opt='-r' - for m in `modprobe -c |egrep "^alias $pattern " |cut -d\ -f3 |uniq`; do + for m in `modprobe -c |egrep "^alias $pattern " |cut -d\ -f3 |unique`; do if [ -n "$m" ] && [ "$m" != off ]; then action "$phrase ($m):" modprobe "$opt" "$m" local rc=$? @@ -63,7 +71,7 @@ load_alsa() # redo with LoadModule? { - modprobe -c |egrep '^alias [^ ]+ snd-' |cut -d\ -f3 |uniq |\ + modprobe -c |egrep '^alias [^ ]+ snd-' |cut -d\ -f3 |unique |\ while read line; do L=1 action "Starting ALSA sound driver $line:" modprobe $line