ab52
January 13, 2011, 7:01am
1
have this code but when i run it i get this error
./pulse: line 2: [: pulseaudio --check ; echo 0: integer expression expected
and here is the code
#!/bin/bash
if [ "pulseaudio --check ; echo $?" -eq "0" ];
then
pulseaudio -k;
fi
what am i doing wrong
thanks
Adam
Scott
January 13, 2011, 7:09am
2
You are comparing the string "pulseaudio --check ; echo $?" with "0".
From the test man page:
INTEGER1 -eq INTEGER2
INTEGER1 is equal to INTEGER2
#!/bin/bash
pulseaudio --check
if [ $? -eq 0 ];
then
pulseaudio -k;
fi
or
#!/bin/bash
if pulseaudio --check
then
pulseaudio -k;
fi
ab52
January 13, 2011, 7:51am
3
thanks that worked like a dream
lastly, is there a way to check is skype is runnung and if so kill it
i can do a
killall skype
but if skype is not running it retuns that there is no process running, which i do not want
Scott
January 13, 2011, 8:06am
4
If "killall skype" works, and you only want to get rid of the message, try adding 2> /dev/null
to the command, or the -q option if you're version has that option.
killall skpye 2>/dev/null