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

HOW TO distiguish between command input and forked subshell ?



On Thu, 5 Sep 1996, Bart Schaefer ANSWERED:

> Subject: Re: HOW TO distiguish between command input and forked subshell ?

> On Sep 6, 12:47am, C. v. Stuckrad ASKED:
> > Subject: HOW TO distiguish between command input and forked subshell ?

> > Exactly, I want to have the function 'chpwd' give some output
> > if triggered by 'cd' or 'chdir' BUT TO GIVE NO OUTPUT
> > if triggered by cases like  '... $(cd somewhere; ls)...' 
*** this was exactly enough specified ***

> chpwd() {
>     if [[ -t 1 ]]
>     then
> 	print By golly, my standard output is a terminal.
>     fi
> }

OK, thanks for explaining (again), and this works perfectly well
in this case of ... $(cd ...)... !

The User who aked was a typical beginner, who used a macro/function
   chpwd () { ...to change x-window-title to the current dir... }
and now the title is no longer changed by cd-ing inside of $()
expansions. BUT if you just type '(cd somwhere; do_something)'
you again get the title changed to 'somewhere' instead of staying
where the zsh stood and stayed !

Does somebody see a chance to distinguish the two cases ?
I first thought $SHLVL, but it stays the same!
Does ...; ( something ) ; ...
the same as ... { something  } ; ...  ???

Again clueless (this time on zsh-users :-)  Stucki

Christoph von Stuckrad       * *  | talk to  | <stucki@xxxxxxxxxxxxxxxxx> \
Freie Universitaet Berlin    |/_* | nickname | ...!unido!fub!leibniz!stucki|
Fachbereich Mathematik, EDV  |\ * | 'stucki' | Tel:+49 30 838-7545{9|8}    |
Arnimallee 2-6/14195 Berlin  * *  |  on IRC  | Fax:+49 30 838-5913        /



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