![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| what is wrong with this tr -d? | cleansing_flame | UNIX for Dummies Questions & Answers | 3 | 02-06-2008 12:34 PM |
| sth wrong of gcc | zither | AIX | 2 | 01-02-2008 01:57 AM |
| What’s wrong with the following? | vrn | UNIX for Dummies Questions & Answers | 8 | 03-19-2006 09:09 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
where have i gone wrong?
ok, i wrote a script called purge.sh
which i referred to in another thread. It prompts the user for a keyword and a username and then kills all of the entered username's processes containing that keyword. However before it does that it asks you how many searches you wish to perform and sets a variable to contain that number, i later use a while loop to repeat the script until that number equals 0. Everything works in the script except for that it just loops infinitely and i cant figure out why. my explanation is pretty vague but the code from the script should help so here it is: #!/bin/bash echo "Purge: Search for and kill target process(EVERYTHING'S case sensitive" echo " " echo -n "Enter amount of times you wish to search or kill a targe t process:" read query_number while [ $query_number > "0" ]; do echo -n "Enter search terms for the target process:" read search_terms echo -n "Enter user running process('all' for everyone):" read process_host if [ $process_host != "all" ]; then process_line=$(ps -U $process_host | grep $search_terms) echo $process_line kill $process_line else process_line=$(ps -axc | grep $search_terms) kill $process_line fi $query_number=$query_number - "1" done can anyone figure out whats wrong? thanks, Blip |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|