Re: =?iso-8859-1?Q?variable=3DStrart=5FProgramPID =3F=3F?=

From: Sam Watkins (swatkins_at_fastmail.fm)
Date: 11/24/04

  • Next message: Jon Dowland: "Re: Subversion package for debian"
    Date: Thu, 25 Nov 2004 02:55:08 +1100
    To: pir aa <pir@austromail.at>
    
    

    On Wed, Nov 24, 2004 at 04:18:13PM +0100, pir aa wrote:
    > I wrote a bash script from which I call one c-program, that is mainly a loop.
    > But in the script I would like to be able to just kill the loop. So I thought,
    > that there must be a way how to get the PID of a program when starting it
    > (then save it in a variable and later use it to call kill). Is there?

    not sure exactly what you want here, but here an example which might help:

      find / > out &
      pid=$!
      sleep 4; kill $pid

    this will find as many files as it can in about ~ 4 seconds,
    then kill the find process.

    The bash "info" doc is helpful, I always forget which funny variable is which,
    you can type:

      info bash var

    to list all the variables, this one $! is one of the "special parameters" at
    the top.

    You may need to install the "bash-doc" package first.

    hope this helps,

    Sam

    -- 
    To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org 
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
    

  • Next message: Jon Dowland: "Re: Subversion package for debian"

    Relevant Pages

    • variable=Strart_ProgramPID ??
      ... I wrote a bash script from which I call one c-program, that is mainly a loop. ... But in the script I would like to be able to just kill the loop. ...
      (Debian-User)
    • Re: Looping prompt for confirmation
      ... then asks if I want to kill them, but it doesn't work quite right: ... prompt is either filled in by stdin from the outer "while" loop, or, if ... though ctrl-c does break the loop. ... # bash -version ...
      (comp.unix.shell)
    • Loop through PIDs, killing them
      ... I need to loop through them and kill ... How do I do that in Bash on Linux? ...
      (comp.unix.shell)
    • Re: Loop through PIDs, killing them
      ... > I have some PIDs (process IDs). ... I need to loop through them and kill ... How do I do that in Bash on Linux? ...
      (comp.unix.shell)
    • Re: string formating
      ... > I am referring to a bash script. ... > I would like to create in a loop a string variable containing in turn ...
      (comp.unix.shell)