Unloading OSS

Questions about applications and software
Forum rules
Before you post please read how to get help
User avatar
Kaye
Level 5
Level 5
Posts: 939
Joined: Fri Feb 06, 2009 5:05 pm
Location: Boston College
Contact:

Unloading OSS

Postby Kaye » Mon Mar 09, 2009 2:38 pm

Hey everyone,

I want a small script that will kill all of the processes using OSS, run soundoff, then run soundon (for me to use after I suspend).

This script seems to work for some people:

Code: Select all

#!/bin/sh
processes=`sudo soundoff | grep ^[0-9] | gawk '{print $1}'`
for process in ${processes[@]}
do
    echo `ps  $process`
    kill $process
done

echo "restarting the oss process"
sudo soundon


But for me gives this error:

Code: Select all

jordan@jordanlaptop ~ $ /usr/lib/pm-utils/sleep.d/48oss.sh
/usr/lib/pm-utils/sleep.d/48oss.sh: 7: Bad substitution


I'm not really familiar enough with bash to fix this (though I've tried!) Can anyone help?

Thanks,
Kaye
"In somnis veritas"
Antivirus or defragging?
Image

User avatar
garda
Level 5
Level 5
Posts: 743
Joined: Sat Aug 30, 2008 2:55 am
Location: /root

Re: Unloading OSS

Postby garda » Mon Mar 09, 2009 3:49 pm

If it is supposed to be a Bash script, you have to change the header from #!/bin/sh to #!/bin/bash.

User avatar
Kaye
Level 5
Level 5
Posts: 939
Joined: Fri Feb 06, 2009 5:05 pm
Location: Boston College
Contact:

Re: Unloading OSS

Postby Kaye » Mon Mar 09, 2009 3:59 pm

Durrrrrrrr. Thank you for not calling me an airhead.. I kinda deserved it :roll:

Edit: One other question, is there any way for me to set this script up to run every time I wake the laptop up, or will I just have to run it manually every time? Thanks.
Last edited by Kaye on Mon Mar 09, 2009 4:05 pm, edited 1 time in total.
"In somnis veritas"
Antivirus or defragging?
Image

User avatar
garda
Level 5
Level 5
Posts: 743
Joined: Sat Aug 30, 2008 2:55 am
Location: /root

Re: Unloading OSS

Postby garda » Mon Mar 09, 2009 4:04 pm

We make mistakes once in a while. Some times a big one while some other times, a small one but misses the eyes. :)


Return to “Software & Applications”

Who is online

Users browsing this forum: No registered users and 19 guests