bug-bash
[Top][All Lists]
Advanced

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

jobs not working in bash scripts (?)


From: Rainer Dorsch
Subject: jobs not working in bash scripts (?)
Date: Fri, 22 Jul 2005 13:50:49 +0200
User-agent: KMail/1.7.2

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.

Thanks,
Rainer





reply via email to

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