killing a co-process in ksh
From: Archie (nrautela_at_gmail.com)
Date: 06/29/05
- Next message: Bruce Barnett: "Re: AWK or otherway to convert transpose Columns to Rows"
- Previous message: Dan Foster: "Can ksh93 do 0..9 type of syntax for loop control?"
- Next in thread: Bill Marcum: "Re: killing a co-process in ksh"
- Reply: Bill Marcum: "Re: killing a co-process in ksh"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 Jun 2005 04:38:58 -0700
Hi,
I have the following script. All I am trying to do is create a
co-process in ksh and then delete it from the main. However I am
getting an error that says
Usage: kill [ -s signame | -signum | -signame ] {pid|job}...
kill -l [exit_status]
Please advise.
#!/usr/bin/ksh
function trap_exit
{
breakOut='Y'
print -p $breakOut
}
function backgroundProc
{
sleptSecs=0
read $breakOut
while [[ $breakOut = 'N' ]]
do
sleep 1;
sleptSecs=`expr $sleptSecs + 1`
echo "Slept for $sleptSecs\n"
read $breakOut
done
}
trap 'trap_exit; exit 2' 1 2 3 15
numSecondsToWait=10
breakOut='N'
backgroundProc |&
backgroundProcPid=$1
echo "proc id is $backgroundProcPid"
sleep $numSecondsToWait
breakOut='Y'
print -p $breakOut
kill backgroundProcPid
exit 0
- Next message: Bruce Barnett: "Re: AWK or otherway to convert transpose Columns to Rows"
- Previous message: Dan Foster: "Can ksh93 do 0..9 type of syntax for loop control?"
- Next in thread: Bill Marcum: "Re: killing a co-process in ksh"
- Reply: Bill Marcum: "Re: killing a co-process in ksh"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]