Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #261897

Re: apt-get aborts in subshell with redirections on Debian 12

From Greg Wooledge <greg@wooledge.org>
Newsgroups linux.debian.user
Subject Re: apt-get aborts in subshell with redirections on Debian 12
Date 2023-09-25 13:30 +0200
Message-ID <HhRWN-bqUN-5@gated-at.bofh.it> (permalink)
References (3 earlier) <HhHup-bkoN-1@gated-at.bofh.it> <HhHNM-bkuD-3@gated-at.bofh.it> <HhJZf-blOm-3@gated-at.bofh.it> <HhKLD-bmjt-1@gated-at.bofh.it> <HhLy1-bmTS-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Sep 25, 2023 at 01:35:38PM +0900, John Crawley wrote:
> > 4) In a bash shell as root (e.g. "su" or "sudo -s"), do:
> > 
> >     errors=$(apt-get install mirage 2>&1 1>/dev/tty)
> 
> -bash: syntax error near unexpected token `2'
> 
> So bash as root has a problem with the redirection.

At this point I'm guessing you made a typo.  Since you didn't show us
the command you typed, that's my official guess.  Any alternative is
too far beyond belief.

> But this worked OK in the same root shell:
> 
> exec 3>1
> errors=$( apt-get install mirage 2>&1 1>&3 )
> exec 3>&-
> 
> If 'mirage' is replaced with 'mirag' then $errors holds the error message.
> 
> So at least something is working!

Note your typo in the first exec command.  You've got FD 3 redirected
to a file named '1', rather than dup-ing stdout.

> Maybe it is an issue with sudo?

According to Michael's discovery, yes.

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-24 09:40 +0200
  Re: apt-get aborts in subshell with redirections on Debian 12 Michel Verdier <mv524@free.fr> - 2023-09-24 12:10 +0200
    Re: apt-get aborts in subshell with redirections on Debian 12 Greg Wooledge <greg@wooledge.org> - 2023-09-24 14:40 +0200
      Re: apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-25 02:20 +0200
        Re: apt-get aborts in subshell with redirections on Debian 12 Greg Wooledge <greg@wooledge.org> - 2023-09-25 02:40 +0200
          Re: apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-25 05:00 +0200
            Re: apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-25 05:20 +0200
            Re: apt-get aborts in subshell with redirections on Debian 12 Greg Wooledge <greg@wooledge.org> - 2023-09-25 05:50 +0200
              Re: apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-25 06:40 +0200
                Re: apt-get aborts in subshell with redirections on Debian 12 Greg Wooledge <greg@wooledge.org> - 2023-09-25 13:30 +0200
                Re: apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-26 04:40 +0200
              Re: apt-get aborts in subshell with redirections on Debian 12 Michael <ml@hemathor.de> - 2023-09-25 11:20 +0200
                Re: apt-get aborts in subshell with redirections on Debian 12 Greg Wooledge <greg@wooledge.org> - 2023-09-25 13:30 +0200
                Re: apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-26 05:00 +0200
                Re: apt-get aborts in subshell with redirections on Debian 12 Greg Wooledge <greg@wooledge.org> - 2023-09-26 05:10 +0200
                Re: apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-26 05:20 +0200
                sudo+use_pty+urxvt+pipe [WAS: apt-get aborts in subshell with  redirections on Debian 12] John Crawley <john@bunsenlabs.org> - 2023-12-24 09:50 +0100

csiph-web