[Pdx-pm] solved: job control (still got a question)
perl at sonofhans.net
Mon Jun 2 17:22:53 CDT 2003
First, thanks for everyone's help. I have one nagging question
(immediately below) and then a brief explanation of what I was
At this point the only thing that confuses me is the output
$ perl -e "print `jobs`"
This does pass 'jobs' to the current shell *and* returns the data I
need, but it appears that perl is trying to 'eval' that data before
it passes it to 'print.' If bash is passing that data into perl
somehow I should be able to inspect or intercept it (I'd think), but I
can't figure out how. That's all curiosity, though, since I have a
solution that works.
As it turns out, Tom's earlier pipe suggestion did the trick (once I
remembered to use <STDIN> instead of @ARGV). The final solution (so
to speak) was this:
PROMPT_COMMAND="PS1=\$(jobs | ~/bin/prompt_me.pl)"
So now you know what I was doing in the first place: messing with my
bash prompt on a lazy Sunday afternoon :) I want to display the
number of stopped jobs iff such jobs exist. I know it's easy with
bash scripting, but I wanted to pound this particular nail with Perl
(ended up pounding with my head instead ...).
p.s. Thanks for all the cc's, too, but I am on the list.
-- notes --
1. I know this because the output is something like:
Can't locate object method "Stopped" via package "man"
... when I have a 'man' invocation stopped.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/pdx-pm-list/attachments/20030602/22a8d481/attachment.bin
More information about the Pdx-pm-list