A little bit of help writing a shell script...

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

User avatar
DesperatMezures
Posts: 50
Joined: Thu Aug 09, 2007 1:00 am UTC
Location: In a cold, dark place, on a computer
Contact:

A little bit of help writing a shell script...

Postby DesperatMezures » Sun Sep 30, 2007 7:53 pm UTC

Hello all, I was wondering whether any of you forumgoers could help me out with this conundrum that I have.

Basically, I recently installed conky on my machine, an ubuntu feisty install. However, if conky is doing it's thing displaying text on the desktop, and I decide to run stepmania, the screen flickers like crazy. This only happens when conky is running, so I thought that perhaps it would be possible to write a shell script which kills conky and starts stepmania, and on the close of stepmania, restarts conky. Currently, the workaround I'm using is to use the menu to kill conky by hand, and then running stepmania (PITA), so I was hoping for some enlightenment.

Any help would be much appreciated.
OLEANA, PUT SOME JELJEL ON MY WUUD TO MAKE IT YOOJ SO I CAN GO BAVOOM!

ubergeek42
Posts: 136
Joined: Tue Mar 20, 2007 2:03 am UTC

Re: A little bit of help writing a shell script...

Postby ubergeek42 » Sun Sep 30, 2007 8:29 pm UTC

I think it would go something like this:

Code: Select all

#!/bin/bash
killall conky
/path/to/stepmainia
/path/to/conky

Since the command to call stepmainia should wait for it to finish running before continuing with the rest of the script.

User avatar
DesperatMezures
Posts: 50
Joined: Thu Aug 09, 2007 1:00 am UTC
Location: In a cold, dark place, on a computer
Contact:

Re: A little bit of help writing a shell script...

Postby DesperatMezures » Sun Sep 30, 2007 9:03 pm UTC

Wow, that was simple. I didn't realize that the script waited for stepmania to finish running before executing the next command.

Many thanks!
OLEANA, PUT SOME JELJEL ON MY WUUD TO MAKE IT YOOJ SO I CAN GO BAVOOM!

User avatar
Cabhan
Posts: 67
Joined: Wed Aug 29, 2007 4:34 am UTC
Location: Boston, MA, USA
Contact:

Re: A little bit of help writing a shell script...

Postby Cabhan » Mon Oct 01, 2007 4:11 am UTC

Yup! Scripts run sequentially. If you want to run a process and then not wait for it, you can "background" the process. This is done by appending an '&' to the end of the line.


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 10 guests