zsh-users
 help / color / mirror / code / Atom feed
* pipe issues with 'jobs' command
@ 2001-10-29  1:37 Le Wang
  2001-10-29  5:21 ` Sweth Chandramouli
  0 siblings, 1 reply; 4+ messages in thread
From: Le Wang @ 2001-10-29  1:37 UTC (permalink / raw)
  To: zsh-users

Hi,

I noticed that the jobs command does not pipe at all,
in fact, creating a pipe seems to just make the output
disappear.  But will redirect to output file still
works (of course not in conjunction with pipe).  See
below:

--------------------------------
le_rhat_pc% jobs
[1]  + running    usr/bin/xemacs
le_rhat_pc% jobs > output.txt
le_rhat_pc% cat output.txt
[1]  + running    usr/bin/xemacs
le_rhat_pc% jobs | cat
le_rhat_pc% jobs > output.txt | cat
le_rhat_pc% cat output.txt
le_rhat_pc% echo `jobs`

le_rhat_pc% echo $(jobs)

le_rhat_pc%
le_rhat_pc% uname -a
Linux le_rhat_pc 2.4.7-6 #1 Wed Aug 29 11:43:50 EDT
2001 i686 unknown
le_rhat_pc% echo $ZSH_VERSION
4.0.4
--------------------------------

Pretty weird, eh?

thanks.
-lw

p.s. I'm new to zsh and the zsh list so I appologize
if this is a FAQ or has already been answered
recently.



_______________________________________________________
Do You Yahoo!?
Get your free @yahoo.ca address at http://mail.yahoo.ca


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pipe issues with 'jobs' command
  2001-10-29  1:37 pipe issues with 'jobs' command Le Wang
@ 2001-10-29  5:21 ` Sweth Chandramouli
  2001-10-30  4:14   ` Le Wang
  0 siblings, 1 reply; 4+ messages in thread
From: Sweth Chandramouli @ 2001-10-29  5:21 UTC (permalink / raw)
  To: Le Wang; +Cc: zsh-users

On Sun, Oct 28, 2001 at 08:37:48PM -0500, Le Wang wrote:
> Pretty weird, eh?
	Not really; this is the expected behaviour.  This was
just discussed in another thread earlier this month; search the archives
for the thread "get the number of active jobs to show in the prompt?".

	-- Sweth.

-- 
Sweth Chandramouli ; <svc@idiopathic.net>
President, Idiopathic Systems Consulting


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pipe issues with 'jobs' command
  2001-10-29  5:21 ` Sweth Chandramouli
@ 2001-10-30  4:14   ` Le Wang
  2001-10-30  4:20     ` Zefram
  0 siblings, 1 reply; 4+ messages in thread
From: Le Wang @ 2001-10-30  4:14 UTC (permalink / raw)
  To: zsh-users

--- Sweth Chandramouli <svc@sweth.net> wrote:
> On Sun, Oct 28, 2001 at 08:37:48PM -0500, Le Wang
> wrote:
> > Pretty weird, eh?
> 	Not really; this is the expected behaviour.  This
> was
> just discussed in another thread earlier this month;
> search the archives
> for the thread "get the number of active jobs to
> show in the prompt?".
> 
> 	-- Sweth.
> 
> -- 
> Sweth Chandramouli ; <svc@idiopathic.net>
> President, Idiopathic Systems Consulting

okay, thanks a lot.  That's really helpful.  So a
subshell was being created on the lhs of the
pipe...that makes sense.  But looking at the following
code from my .zshrc:

--------------
getJobCount () {
  print "$#jobtexts";
}

prompt_le1_precmd () {
  PS1="$(getJobCount) %# "
  PS2="%_> "
  PS3="?# "
}
--------------

If I call getJobCount from the shell directly (e.g.
execute the command 'getJobCount'), I get the real
number of jobs, but my prompt always prints 0.  What's
going on here?

thanks
-lw

_______________________________________________________
Do You Yahoo!?
Get your free @yahoo.ca address at http://mail.yahoo.ca


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pipe issues with 'jobs' command
  2001-10-30  4:14   ` Le Wang
@ 2001-10-30  4:20     ` Zefram
  0 siblings, 0 replies; 4+ messages in thread
From: Zefram @ 2001-10-30  4:20 UTC (permalink / raw)
  To: Le Wang; +Cc: zsh-users

Le Wang wrote:
>getJobCount () {
>  print "$#jobtexts";
>}
>
>prompt_le1_precmd () {
>  PS1="$(getJobCount) %# "
>  PS2="%_> "
>  PS3="?# "
>}
>--------------
>
>If I call getJobCount from the shell directly (e.g.
>execute the command 'getJobCount'), I get the real
>number of jobs, but my prompt always prints 0.  What's
>going on here?

$() also creates a subshell.

You might find psvar and the %v prompt sequence helpful.

-zefram


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-10-30  4:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-29  1:37 pipe issues with 'jobs' command Le Wang
2001-10-29  5:21 ` Sweth Chandramouli
2001-10-30  4:14   ` Le Wang
2001-10-30  4:20     ` Zefram

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).