in reply to Re: How to know if a perl script is put in the background
in thread How to know if a perl script is put in the background

I created a small sample for you below. This behaves the same way ..
OS: Linux 2.6.9-67.0.20 (SCL - Scientific Linux 4)
Shell: bash
Perl: 5.8.5
1 #!/usr/bin/perl 2 3 use strict; 4 use warnings; 5 6 print "# Start script\n"; 7 print "\n -> Waiting 2 seconds\n"; 8 sleep(2); 9 print "\n -> Waiting 2 seconds\n"; 10 sleep(2); 11 print "# Exiting .. \n";

Replies are listed 'Best First'.
Re^3: How to know if a perl script is put in the background
by almut (Canon) on Nov 18, 2008 at 17:12 UTC

    Can't reproduce it, though I'm also using Linux and bash.  With your sample code I'm getting something like:

    $ ./724323.pl & [2] 10620

    (no further output)

    $ ps x | grep 724323 10620 pts/1 T 0:00 /usr/bin/perl ./724323.pl

    (the 'T' indicates that the script has been stopped)

    $ fg ./724323.pl # Start script -> Waiting 2 seconds -> Waiting 2 seconds # Exiting ..

    (after foregrounding it, output continues normally)