From: Roman Neuhauser <neuhauser@sigpipe.cz>
To: zsh-users@zsh.org
Subject: chpwd, precmd hooks have "zsh" in $0
Date: Mon, 9 Aug 2021 22:15:34 +0200 [thread overview]
Message-ID: <YRGM5st2N0tfvPMQ@isis.sigpipe.cz> (raw)
as the subject says, at least the chpwd and precmd hooks
have the shell's argv[0] in $0.
seen in both zsh-5.8-0-g77d203f
and zsh-5.8-462-g765bc14. put the reproducer below in
argzero.zsh and source it into a fresh shell (zsh -f).
start the shell using its absolute path, that's what you'll
see.
% /usr/local/bin/zsh -f
% . ./argzero.zsh
ZSH_PATCHLEVEL: zsh-5.8-462-g765bc14
top: nofunctionargzero off
top: posixargzero off
precmd output should be below this message.
'cd .' will utilize all three hooks.
precmd: nofunctionargzero off
precmd: posixargzero off
precmd: /usr/local/bin/zsh <------
% cd .
preexec: nofunctionargzero off
preexec: posixargzero off
preexec: preexec <------
chpwd: nofunctionargzero off
chpwd: posixargzero off
chpwd: /usr/local/bin/zsh <------
precmd: nofunctionargzero off
precmd: posixargzero off
precmd: /usr/local/bin/zsh <------
argzero.zsh:
print ZSH_PATCHLEVEL: $ZSH_PATCHLEVEL
set -o > >(sed -n "/argzero/s/^/top: /p")
function chpwd {
set -o > >(sed -n "/argzero/s/^/chpwd: /p")
print chpwd: "$0" '<------'
}
function precmd {
set -o > >(sed -n "/argzero/s/^/precmd: /p")
print precmd: "$0" '<------'
}
function preexec {
set -o > >(sed -n "/argzero/s/^/preexec: /p")
print preexec: "$0" '<------'
}
cat <<EOF
precmd output should be below this message.
'cd .' will utilize all three hooks.
EOF
--
roman
next reply other threads:[~2021-08-09 20:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-09 20:15 Roman Neuhauser [this message]
2021-08-09 21:26 ` Bart Schaefer
2021-08-10 11:33 ` Roman Neuhauser
2021-08-10 17:31 ` Bart Schaefer
2021-08-12 4:40 ` Roman Neuhauser
2021-08-15 21:10 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YRGM5st2N0tfvPMQ@isis.sigpipe.cz \
--to=neuhauser@sigpipe.cz \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).