kill was giving me an error when I tried to terminate the script, but I changed the line to killall setiathome and it works now, thanks for your help.
Jesse
On Sat, 2002-11-09 at 20:39, Alexander Tsang wrote:
> On Sat, 2002-11-09 at 19:09, Jesse Kline wrote:
> > I've made a very simple bash script to run setiathome and xsetiathome.
> > The script looks like this:
> > #!/bin/sh
> > ~/setiathome/setiathome -graphics &
> > ~/setiathome/xsetiathome
> > exit 0
> > My question is, since I made the setiathome process into a background
> > process, how can I get it to terminate when I terminate the script (done
> > by hitting Control-C at the command line)?
> >
> > Thank you,
> >
> > Jesse
> >
> >
>
>
> This should work:
>
> #!/bin/sh
>
> trap "finish" 2 # trap ctrl-c
>
> finish()
> {
> kill $PID
> }
>
> ~/setiathome/setiathome -graphics &
> PID=$!
> ~/setiathome/xsetiathome
> exit 0
>
>
>
>
signature.asc
Description: This is a digitally signed message part
