zsh-workers
 help / color / mirror / code / Atom feed
From: Tanaka Akira <akr@jaist.ac.jp>
To: zsh-workers@sunsite.auc.dk
Subject: exec last command in last pipeline.
Date: 15 Aug 1999 01:04:59 +0900	[thread overview]
Message-ID: <rsq7lmy73h0.fsf@crane.jaist.ac.jp> (raw)

Z:akr@is27e1u11% zsh -frc 'exec echo a'
a
Z:akr@is27e1u11% zsh -fc 'exec > /dev/null'
zsh: redirection with no command
zsh: exit 1     zsh -fc 'exec > /dev/null'
Z:akr@is27e1u11% zsh -fc 'exec printenv SHLVL'
2
Z:akr@is27e1u11% zsh -c 'print $$; sh -c '\''echo $$; printenv SHLVL'\'''
9076
9076
2
Z:akr@is27e1u11% 

I think they should be:

Z:akr@is27e1u11% zsh -frc 'exec echo a'        
exec: echo: restricted
zsh: exit 1     zsh -frc 'exec echo a'
Z:akr@is27e1u11% zsh -fc 'exec > /dev/null' 
Z:akr@is27e1u11% zsh -fc 'exec printenv SHLVL' 
1
Z:akr@is27e1u11% zsh -c 'print $$; sh -c '\''echo $$; printenv SHLVL'\''' 
9078
9078
1
Z:akr@is27e1u11% 

Index: exec.c
===================================================================
RCS file: /projects/zsh/zsh/Src/exec.c,v
retrieving revision 1.1.1.19
diff -u -F^( -r1.1.1.19 exec.c
--- exec.c	1999/07/24 14:02:56	1.1.1.19
+++ exec.c	1999/08/14 15:55:32
@@ -1522,7 +1522,7 @@
 
 	    /* Current shell should not fork unless the *
 	     * exec occurs at the end of a pipeline.    */
-	    if ((cflags & BINF_EXEC) && last1 == 2)
+	    if ((cflags & BINF_EXEC) && last1)
 		flags |= CFLAG_EXEC;
 
 	    /* Empty command */
@@ -2053,8 +2053,9 @@
 	    restore_params(restorelist, removelist);
 
 	} else {
-	    if (flags & CFLAG_EXEC) {
+	    if (!forked)
 		setiparam("SHLVL", --shlvl);
+	    if (flags & CFLAG_EXEC) {
 		/* If we are exec'ing a command, and we are not *
 		 * in a subshell, then save the history file.   */
 		if (!subsh && isset(RCS) && interact && !nohistsave)
-- 
Tanaka Akira


             reply	other threads:[~1999-08-14 16:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-08-14 16:04 Tanaka Akira [this message]
1999-08-14 22:05 ` Bart Schaefer
1999-08-15  6:12   ` Tanaka Akira

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=rsq7lmy73h0.fsf@crane.jaist.ac.jp \
    --to=akr@jaist.ac.jp \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).