A question on inverting a bash script statement...
Let's say I want to have the System Bell ring when a process is over say a download.
First I created a file named 'beep' that plays the System Bell. Because the System Bell rings by hitting cntrl-G the 'beep' file looks like this. Code:
echo ^G Code:
wget http://www.domain.com/somefile && /root/beep I wanted to write the Bash script along the following logic and with the fewest lines possible. Not really a script, I want to insert this short script via command line instead of a file. Let's say the download has commenced and the PID = 16666. Code:
until ps -p 16666 |
Well I would probably just ask why you don't just use while instead of until?
|
How would I construct it exactly?
Code:
while ps -p 16666 I also tried Code:
while ps -p 16666 |
Quote:
I think you need some bash tutorials. Here are some links: http://www.linuxtutorialblog.com/pos...-if-statements http://tldp.org/LDP/abs/html/ http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html http://freshmeat.net/projects/advanc...scriptingguide |
I tried this script and it didn't work
Code:
#!/bin/bash |
You can use /proc/<pid> instead of ps -p to determine if a process is still running. Here is a little demo script notifyjob (just for fun) that waits for a pid to finish and writes to the specified user's terminal:
Code:
#/bin/bash Code:
/usr/local/bin/myjob & |
All times are GMT -5. The time now is 10:32 PM. |