zsh-users
 help / color / mirror / code / Atom feed
* Re: FW: Full path with ksh emulation
       [not found] <200601060047.k060lU37023709@rly01c.srv.mailcontrol.com>
@ 2006-01-06 10:38 ` Peter Stephenson
  2006-01-06 14:15   ` Annoying misfeature: ZSH completely hides output without newlines! Einar Huginson
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Stephenson @ 2006-01-06 10:38 UTC (permalink / raw)
  To: zsh-users

"Tony Hasler" wrote:
> The bad news is that it didn't work.  It tries to find the argument in
> $PATH, but when "." isn't there it reverts to the builtin.  When "." is in
> the path you get an absolute path, but one with a "." in it.  Only when the
> absolute path of "." is in $PATH and is the first place with an executable
> copy of the script does it seem to work.

Ah.  You're right.

>   if [[ $(builtin whence $1) == .* ]]; then

That looks good enough.  You can optimise out the subprocess by changing
this to

   if [[ $1 == .* || $(builtin whence $1) == .* ]]; then

the point being that in your case, where . isn't part of the path, you
are actually relying on the . being part of $1, so you never need the
code in the $(...).

You could probably change the patterns to (.|..)/* (as we're in
zsh-specific land) for a little extra safety but it doesn't make much
difference unless you have files starting with ".".

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


Your mail client is unable to display the latest news from CSR. To access our news copy this link into a web browser:  http://www.csr.com/email_sig.html


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

* Annoying misfeature: ZSH completely hides output without newlines!
  2006-01-06 10:38 ` FW: Full path with ksh emulation Peter Stephenson
@ 2006-01-06 14:15   ` Einar Huginson
  2006-01-06 14:25     ` Vincent Lefevre
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Einar Huginson @ 2006-01-06 14:15 UTC (permalink / raw)
  To: zsh-users

I have tried this with ZSH 4.2.5 and 4.2.6, linked against ncurses 5.4 
(specifically the Gentoo ebuild 5.4-r6). Note that PS1='$ ' and I have marked 
the cursor position with _

1. Example: Just echo text without a newline

	$ echo -n foo
	$ _

2. Example: cat a file that has no newline after the last (third!) line

	$ cat bar
	blah1
	blah2
	$ _

Note that the cat command itself works, the data is not lost, just not being  
displayed in ZSH

	$ cat bar | wc -w
	3
	$ _

Compare with the output by bash

	$ echo -n foo
	foo$ _

	$ cat bar
	blah1
	blah2
	blah3$ _

IMHO, this counts as a serious problem, since certain file contents are no 
longer visible, and files appear to be empty even if they aren't. I initially 
thought that my more involved prompt was at fault, but that doesn't seem to 
be the case (PS1='$ '). Or do I need to set a ZSH config option that prevents 
it from clearing the line before outputting the prompt?

Confused,
  Andreas Koch


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

* Re: Annoying misfeature: ZSH completely hides output without newlines!
  2006-01-06 14:15   ` Annoying misfeature: ZSH completely hides output without newlines! Einar Huginson
@ 2006-01-06 14:25     ` Vincent Lefevre
  2006-01-06 14:26     ` Frank Terbeck
  2006-01-06 14:39     ` Jean Chalard
  2 siblings, 0 replies; 6+ messages in thread
From: Vincent Lefevre @ 2006-01-06 14:25 UTC (permalink / raw)
  To: zsh-users

On 2006-01-06 15:15:27 +0100, Einar Huginson wrote:
> I have tried this with ZSH 4.2.5 and 4.2.6, linked against ncurses
> 5.4 (specifically the Gentoo ebuild 5.4-r6). Note that PS1='$ ' and
> I have marked the cursor position with _
> 
> 1. Example: Just echo text without a newline
> 
> 	$ echo -n foo
> 	$ _

This is a FAQ (man zshoptions).

> [...] Or do I need to set a ZSH config option that prevents it from
> clearing the line before outputting the prompt?

Yes.

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA


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

* Re: Annoying misfeature: ZSH completely hides output without newlines!
  2006-01-06 14:15   ` Annoying misfeature: ZSH completely hides output without newlines! Einar Huginson
  2006-01-06 14:25     ` Vincent Lefevre
@ 2006-01-06 14:26     ` Frank Terbeck
  2006-01-06 14:35       ` Einar Huginson
  2006-01-06 14:39     ` Jean Chalard
  2 siblings, 1 reply; 6+ messages in thread
From: Frank Terbeck @ 2006-01-06 14:26 UTC (permalink / raw)
  To: zsh-users

Einar Huginson <huginson@web.de> wrote:
> I have tried this with ZSH 4.2.5 and 4.2.6, linked against ncurses 5.4 
> (specifically the Gentoo ebuild 5.4-r6). Note that PS1='$ ' and I have marked 
> the cursor position with _
> 
> 1. Example: Just echo text without a newline
> 
> 	$ echo -n foo
> 	$ _

setopt nopromptcr

Regards, Frank



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

* Re: Annoying misfeature: ZSH completely hides output without newlines!
  2006-01-06 14:26     ` Frank Terbeck
@ 2006-01-06 14:35       ` Einar Huginson
  0 siblings, 0 replies; 6+ messages in thread
From: Einar Huginson @ 2006-01-06 14:35 UTC (permalink / raw)
  To: zsh-users

My apologies for not looking at the FAQ, I seriously did not consider the 
possibility that such ZSH behavior might be intentional.

Thanks for the pointers!

Andreas

On Friday 06 January 2006 15:26, Frank Terbeck wrote:
> Einar Huginson <huginson@web.de> wrote:
> > I have tried this with ZSH 4.2.5 and 4.2.6, linked against ncurses 5.4
> > (specifically the Gentoo ebuild 5.4-r6). Note that PS1='$ ' and I have
> > marked the cursor position with _
> >
> > 1. Example: Just echo text without a newline
> >
> > 	$ echo -n foo
> > 	$ _
>
> setopt nopromptcr
>
> Regards, Frank


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

* Re: Annoying misfeature: ZSH completely hides output without newlines!
  2006-01-06 14:15   ` Annoying misfeature: ZSH completely hides output without newlines! Einar Huginson
  2006-01-06 14:25     ` Vincent Lefevre
  2006-01-06 14:26     ` Frank Terbeck
@ 2006-01-06 14:39     ` Jean Chalard
  2 siblings, 0 replies; 6+ messages in thread
From: Jean Chalard @ 2006-01-06 14:39 UTC (permalink / raw)
  To: Einar Huginson; +Cc: zsh-users

> IMHO, this counts as a serious problem, since certain file contents are no

Essentially a matter of taste :)


> Or do I need to set a ZSH config option that prevents
> it from clearing the line before outputting the prompt?

Yes. You can use
setopt no_prompt_cr
...to prevent zsh from printing a carriage return before its prompt,
like most other shells do.

If you use a recent enough zsh (4.3.0), the option PROMPT_SP is
available and is supposed to do about what everyone expects in about
every case (and has been made the default).


Note that this entry is listed in the FAQ as the most often asked
question about ZSH :p

--
J
"Toi, je te trouve pas la même tête que sur la page précédente" -- Wakamiya

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

end of thread, other threads:[~2006-01-06 14:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200601060047.k060lU37023709@rly01c.srv.mailcontrol.com>
2006-01-06 10:38 ` FW: Full path with ksh emulation Peter Stephenson
2006-01-06 14:15   ` Annoying misfeature: ZSH completely hides output without newlines! Einar Huginson
2006-01-06 14:25     ` Vincent Lefevre
2006-01-06 14:26     ` Frank Terbeck
2006-01-06 14:35       ` Einar Huginson
2006-01-06 14:39     ` Jean Chalard

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).