Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: fg jobs info



On Sun, Sep 02, 2007 at 10:59:53AM -0700, Bart Schaefer wrote:
[...]
>     fg() {
> 	# Obviously this needs error handling added, etc.
>     	typeset -g fgjob=$(jobs $*)
> 	builtin fg $*
>     }
> 
> and then stuff the title bar (or whatever) with the something parsed
> out of $fgjob.

I'd like to point out that $* is not the right way to pass
parameters around. $* strips the empty arguments.

You want "$@" (with quotes) as with the other shells.

Also, in zsh (contrary to ksh and bash), typeset is a builtin
parsed like any other builtin, so in the typeset command above,
the command substitution will be word spit, you want:

typeset -g fgjob="$(jobs "$@")"

Or better

typeset -g fgjob
fgjob=$(jobs "$@")

not sure the typeset -g is needed there.

-- 
Stéphane



Messages sorted by: Reverse Date, Date, Thread, Author