Fixed Speak
[clearscm.git] / bin / rmbg
1 #!/bin/bash
2
3 # We need our sj function...
4 source ~/.rc/functions
5
6 # Get the PID of the running setbg process
7 setbgPID=$(sj setbg | awk '{print $2}')
8
9 # Check to make sure it's not blank, meaning no setbg process running
10 if [ -s "$setbgPID" ]; then
11   echo "There is no setbg process running"
12   exit 1
13 fi
14
15 # Check to see if setbgPID has multiple processes. Multiple processes
16 # should never happen but if we get more than one PID back then they
17 # will be listed side by side with spaces, so check that.
18 echo $setbgPID | grep -q ' '
19
20 if [ $? = 0 ]; then
21   echo "There are multiple setbg processes???"
22   exit 1
23 fi
24
25 setbgPicture=$(cat ~/.setbg)
26 rm "$setbgPicture" && kill -USR1 $setbgPID