Unloading OSS

Questions about applications and software
Forum rules
Before you post please read this

Unloading OSS

Postby Kaye on 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
Kaye
Level 5
Level 5
 
Posts: 942
Joined: Fri Feb 06, 2009 5:05 pm
Location: Boston College

Linux Mint is funded by ads and donations.
 

Re: Unloading OSS

Postby garda on 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
garda
Level 5
Level 5
 
Posts: 744
Joined: Sat Aug 30, 2008 2:55 am
Location: /root

Re: Unloading OSS

Postby Kaye on 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
Kaye
Level 5
Level 5
 
Posts: 942
Joined: Fri Feb 06, 2009 5:05 pm
Location: Boston College

Re: Unloading OSS

Postby garda on 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. :)
User avatar
garda
Level 5
Level 5
 
Posts: 744
Joined: Sat Aug 30, 2008 2:55 am
Location: /root


Return to Software & Applications

Who is online

Users browsing this forum: salmakhan94 and 20 guests