[Top][All Lists]

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

Re: jobs cmd returns * instead or file name

From: Offer Kaye
Subject: Re: jobs cmd returns * instead or file name
Date: Fri, 15 Feb 2002 23:37:56 +0200

On Friday 15 February 2002 08:27 pm, you wrote:
> > Machine Type: i586-mandrake-linux-gnu
> >
> > Bash Version: 2.05
> > Patch Level: 1
> > Release Status: release
> >
> > Description:
> >     when I use for example:
> >        function te(){ nedit $@ & }
> >        te kuku
> >        jobs
> >     I get as the output of the "jobs" command:
> >        [1]+  Running                 nedit $@ &
> >     i.e., instead of returning the file name it gives the "$@" string, which
> > is *not* what I wanted- how can I know which job is which if I have
> > several "te"s running? BTW, the same thing happens if I choose emacs
> > instead of nedit...
> When a simple command is run asynchronously, the subshell is forked before
> the command is expanded, so any assignment statements that are performed
> as part of the expansion don't affect the parent shell's environment.
> The `job name' is set when the job is created -- that is, when the child
> process is created.  At that time, since expansion has not been performed,
> the job name is still `nedit $@'.  Since the child process handles the
> expansion, there's no way for the parent to change the job name.
> It's admittedly sub-optimal, but I'd rather have correct behavior with
> respect to the separation between parent and child execution contexts.
> Chet

Chet- First, thanks for the clarification!
Second, I'm no programmer, but it seems to me that the parent could maybe do 
a "demi-expansion" on the arguments - i.e., not really expand them, just see 
what would come out if it expanded them.
Then, presuming it used the same rules as the child, you'd get the same name 
for the job name and what the child is running, but without really 
interfering with the parent-child separation.
Kind of like both eating your cake and keeping it... :-)
Like I said before, I'm no programmer, so I wouldn't even begin to know how 
to implement the above (or even if it's possible/makes sense).
However, I'll be glad to contribute in another way- say, updating the 
Please let me know if I can be of assistance.
Francis- thanks for the work-around - it works, so no matter that it looks 
terrible, for now I'll use it...

Have a nice day :-)

reply via email to

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