How should this code be developed?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How should this code be developed?
# 1  
Old 09-22-2010
How should this code be developed?

i'm trying to test whether wget is working still or not.

Code:
while [ wget is still running ] <----- how should this look please.
do
 codes
done

# 2  
Old 09-22-2010
Code:
while pgrep wget > /dev/null
do
   codes...
done

This User Gave Thanks to frans For This Post:
# 3  
Old 09-22-2010
Is the wget running as a foreground process or a background process?
If it is the former, then you obviously know when its finished.
If its a background process that has been started in the current shell script you can "wait $!" to wait for it to finish.
This User Gave Thanks to citaylor For This Post:
# 4  
Old 09-22-2010
how about to test ifits not running?
i seems can't see it in the man page.
# 5  
Old 09-22-2010
Two ways :
Code:
while ! pgrep wget
...

or
Code:
until pgrep wget
...

! negates the condition
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. OS X (Apple)

Can a ios app be developed on a windows or ipad?

hi, i want to start developing an ios app that can be used on iphone and ipad. can anyone guide me how to start? i saw that it can be developed only on a mac system.. but i dont have a mac system. i have an ipad 4 and a laptop with windows os? can i use one of these to start developing ios app??... (4 Replies)
Discussion started by: Little
4 Replies

2. UNIX for Dummies Questions & Answers

How can I rebuild applications that developed in UNIX? I need to use it in windows os with cygwin

I need to rebuild an application that developed in unix environment and run in windows OS with cygwin. so How can I rebuild from the source code? is there any one who said something on this regard? (2 Replies)
Discussion started by: bejirond
2 Replies

3. Shell Programming and Scripting

Block of code replacement in Java source code through Unix script

Hi, I want to remove the following code from Source files (or replace the code with empty.) from all the source files in given directory. finally { if (null != hibernateSession && hibernateSession.isOpen()) { //hibernateSession.close(); } } It would be great if the script has... (2 Replies)
Discussion started by: hareeshram
2 Replies

4. Shell Programming and Scripting

New wrapper script will be developed to wrap two ksh scripts

Hi friend,:) The script should invoke these scripts sequentially! When one will finish the second will start. Please help me with it, thanks,:b: Ishai (3 Replies)
Discussion started by: ishai82
3 Replies

5. Post Here to Contact Site Administrators and Moderators

How was the Gollum Developed?

Can you please tell me how Gollum was created for a forum? I know of the ALICE and other bots but integrating the interface has always been my wish... Can someone give me some pointers on how to achieve this? (2 Replies)
Discussion started by: Legend986
2 Replies

6. Programming

Bug has developed

Guys there is another bug that has developed.........now messaged above 6 bytes are trimmed and echoed back to client.After the first message the echo is not regular.I have put a loop in both client and server to check for closing.Moreover for connection close i also need to put another clause that... (3 Replies)
Discussion started by: arjunjag
3 Replies
Login or Register to Ask a Question