until command

Hi
I need to kill a process by taking the value of number of lines in the input file
if the input file value turns 1 then stop the kill process..
my scipt looks like

#/bin/sh
hello ()
{
ps -ef |grep "false"  > test
val=`wc -l < test`
count=1
echo $val
until  [ $val -gt $count ]
do
ps -ef |grep "false" |awk '{printf "tstl -9 %s\n",$8}' |head -1 
done
return
}
hello

can anyone correct the script.

thanks
Antony

I'm not really following what you're trying to achieve. What is in the text file you're running wc against and what process are you trying to kill?

while or until, if you are comparing some value, then you maybe need to change value between do and done.

Example to kill all those process which line include false

ps -ef | grep "false" | grep -v grep | awk '{print $2}' | xargs kill 

Or loop, send signal and test again

process="false"
while (ps -ef | grep "$process" >/dev/null  | grep -v grep  ) >/dev/null 2>&1
do
      ps -ef | grep "$process" | grep -v grep | awk '{print $2}' | xargs kill 
      sleep 10
done     

thank you.. this is what excatly I was looking for..

thanks a lot