zsh-users
 help / color / mirror / code / Atom feed
* quick question about '%s' expansion
@ 2001-09-08 21:45 Simon Hausmann
  2001-09-08 21:54 ` Borsenkow Andrej
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Hausmann @ 2001-09-08 21:45 UTC (permalink / raw)
  To: zsh-users

Hi,

I have a question regarding the expansion of '%s' for
commands. Issuing

	date +%s

results in the following output

	" date "+" date "+"999985277

using zsh 4.0.2 . However it works correctly (just printing the
amount of seconds) using an older zsh (3.x) . 
Is this a bug in 4.0.2?


Thanks,
Simon


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

* Re: quick question about '%s' expansion
  2001-09-08 21:45 quick question about '%s' expansion Simon Hausmann
@ 2001-09-08 21:54 ` Borsenkow Andrej
  2001-09-09  8:17   ` Simon Hausmann
  0 siblings, 1 reply; 5+ messages in thread
From: Borsenkow Andrej @ 2001-09-08 21:54 UTC (permalink / raw)
  To: Simon Hausmann; +Cc: zsh-users

Simon Hausmann wrote:
> 	date +%s
> 
> results in the following output
> 
> 	" date "+" date "+"999985277
> 

{pts/2}% date +%s
999985938
{pts/2}% echo $ZSH_VERSION
4.0.2

Check with zsh -f. Is it possible that date is aliased/defined as function?

-andrej


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

* Re: quick question about '%s' expansion
  2001-09-08 21:54 ` Borsenkow Andrej
@ 2001-09-09  8:17   ` Simon Hausmann
  2001-09-09 16:00     ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Hausmann @ 2001-09-09  8:17 UTC (permalink / raw)
  To: Borsenkow Andrej; +Cc: zsh-users

On Sun, Sep 09, 2001 at 01:54:01AM +0400, Borsenkow Andrej wrote:
> Simon Hausmann wrote:
> > 	date +%s
> > 
> > results in the following output
> > 
> > 	" date "+" date "+"999985277
> > 
> 
> {pts/2}% date +%s
> 999985938
> {pts/2}% echo $ZSH_VERSION
> 4.0.2
> 
> Check with zsh -f. Is it possible that date is aliased/defined as function?

Ah, yes, with -f it works. Silly me, I had a preexec which looked like

	preexec () {print -Pn "\e]0;%n@%m: $*\a"}

and apparently the %s got caught by the prompt expansion, causing output
beyond the xterm escape sequence. I splitted it up in two print's 
(one with -P and one without) and now it works :)


Simon


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

* Re: quick question about '%s' expansion
  2001-09-09  8:17   ` Simon Hausmann
@ 2001-09-09 16:00     ` Bart Schaefer
  2001-09-09 16:34       ` Simon Hausmann
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2001-09-09 16:00 UTC (permalink / raw)
  To: Simon Hausmann; +Cc: zsh-users

On Sep 9, 10:17am, Simon Hausmann wrote:
} Subject: Re: quick question about '%s' expansion
}
} Ah, yes, with -f it works. Silly me, I had a preexec which looked like
} 
} 	preexec () {print -Pn "\e]0;%n@%m: $*\a"}

The definition of preexec changed just before the 4.0 release.  Re-read
the manual entry for it.  You almost certainly want to use $1 or $2, not
$*, in your xterm title.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

* Re: quick question about '%s' expansion
  2001-09-09 16:00     ` Bart Schaefer
@ 2001-09-09 16:34       ` Simon Hausmann
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Hausmann @ 2001-09-09 16:34 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

On Sun, Sep 09, 2001 at 04:00:01PM +0000, Bart Schaefer wrote:
> On Sep 9, 10:17am, Simon Hausmann wrote:
> } Subject: Re: quick question about '%s' expansion
> }
> } Ah, yes, with -f it works. Silly me, I had a preexec which looked like
> } 
> } 	preexec () {print -Pn "\e]0;%n@%m: $*\a"}
> 
> The definition of preexec changed just before the 4.0 release.  Re-read
> the manual entry for it.  You almost certainly want to use $1 or $2, not
> $*, in your xterm title.

Whoops, $1 looks much better, indeed. Thanks for your help!


Simon


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

end of thread, other threads:[~2001-09-09 16:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-08 21:45 quick question about '%s' expansion Simon Hausmann
2001-09-08 21:54 ` Borsenkow Andrej
2001-09-09  8:17   ` Simon Hausmann
2001-09-09 16:00     ` Bart Schaefer
2001-09-09 16:34       ` Simon Hausmann

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