bug-bash
[Top][All Lists]
Advanced

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

Re: jobs cmd returns * instead or file name


From: Francis Montagnac
Subject: Re: jobs cmd returns * instead or file name
Date: 14 Feb 2002 14:47:51 GMT

>       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?

The following horror may be used:

te(){
    _inbg nedit "$@"
}

_inbg() {
    local -a inbg_args=("$@")
    # Use eval to expand $* in the job list
    eval "inbg \"$*\"&"
}

inbg() {
    "${inbg_args[@]}"
}

Example:

$ te /etc/motd
[1] 26802
$ jobs
[1]+  Running                 inbg "nedit /etc/motd" &
$ 

-- 
Francis.Montagnac@sophia.inria.fr, Tel: (33) 04 92 38 79 11, Bur: E106
INRIA Sophia, 2004, rte des Lucioles, B.P.93 - 06902 Sophia Antipolis Cedex



reply via email to

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