Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
autocd in scripts
- X-seq: zsh-workers 33645
- From: Clint Hepner <clint.hepner@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: autocd in scripts
- Date: Sat, 8 Nov 2014 08:44:21 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=nEs3rg0aM3Bx51uYQGgNDwN0bNsZP3Xhk+U4rapD21c=; b=KXXpf6Px7ylsiqf1uJifS6xm+oZgyYZe6o+kGq9R9aTrbIRql9q65rF5HnryuuMyoV hdG8W+GVAWwV5AmTlAEnSzVGK0qWVOXqeLGBJm/3u/CRiaWAWkZWw/HYVZenfdfvWG2F 7eux8e6vG2Y+mYywToSmh/7IAQhlaBbu05cqOTFm19UGn6IsurmSLlq9WK8XaLJZJqfN hMNHL0/LrI3dRiMIa0/pvshdP6zzsek4wQHJPcnGYfHwRJCEL5y+ZoC0y/viU9HDAO3B mf/3PSAxKrcZWnuOmYClCW9Ml3FT3ivdBfDvGlcbbPhvRma/lLj+87/9nn8lfXmtPVlj rN4A==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
A question on Stack Overflow recently asked about using the AUTO_CD option
in a script,
as it did not appear to work. I couldn't find anything in the documentation
about it, but a
peek at exec.c revealed that for
setopt autocd
mkdir foo
foo
# $pwd is now foo
to work, the SHIN_STDIN option needs to be in effect as well:
# Src/exec.c, execcmd()
char trycd = (isset(AUTOCD) && isset(SHINSTDIN) &&
(!redir || empty(redir)) && args && !empty(args) &&
!nextnode(firstnode(args)) && *(char
*)peekfirst(args));
I realize AUTO_CD is intended as an interactive feature, but requiring
commands be read
from standard input seems like a proxy for checking if the shell is
interactive. I was
wondering if there was a reason for this specific check, and if it could
either be relaxed
or documented with AUTO_CD.
Clint
Messages sorted by:
Reverse Date,
Date,
Thread,
Author