bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: jobs not working in bash scripts (?)


From: William Park
Subject: Re: jobs not working in bash scripts (?)
Date: Fri, 22 Jul 2005 12:31:45 -0400
User-agent: Mutt/1.4.2i

On Fri, Jul 22, 2005 at 01:50:49PM +0200, Rainer Dorsch wrote:
> Hello,
> 
> I was debugging a larger script, and found that the buildtin jobs command 
> does 
> not work in bash scripts, altough it does in an interactive shell:
> 
> rdorsch@paddy:~/tmp.nobackup$ cat testjob
> #!/bin/bash
> 
> sleep 35 &
> jobs -p %%
> rdorsch@paddy:~/tmp.nobackup$ ./testjob
> rdorsch@paddy:~/tmp.nobackup$ . testjob
> 17825
> rdorsch@paddy:~/tmp.nobackup$
> 
> It might be a feature, in the man page, I read:
> 
>        The symbols  %%  and
>        %+  refer  to  the shell's notion of the current job, which is the last
>        job stopped while it was in the foreground  or  started  in  the  back-
>        ground.
> 
> ...but I don't read out of that that it does not work in a non-interactive 
> shell.
> 
> I know it worked before in that script and ksh does not make a difference 
> between interactive and non-interactive shell. But I don't know
> 
> Any comments are welcome.

See if 
    set -m
makes any difference.

-- 
William Park <opengeometry@yahoo.ca>, Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
           http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
          http://freshmeat.net/projects/bashdiff/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]