help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Root access in subshell


From: Seth David Schoen
Subject: Re: [Help-bash] Root access in subshell
Date: Mon, 3 Feb 2014 15:21:34 -0800
User-agent: Mutt/1.5.21 (2010-09-15)

Richard Taubo writes:

> Sorry for the unclarity.
> I meant: Return the *result* of the command in the subshell to the main shell.

I think for most people who work with bash, the term "result" means the
numeric return code of the subshell command.

$ (echo foo; exit 3)
foo
$ echo $?
3

Also known as the exit code, this is a single-byte value that was
returned by the last command run in the subshell when it exited.

It seems like you might be talking about the output of the subshell
command (whatever data it writes to its standard output).

bash allows you to do a couple of things with that output.  The
most common are:

- pipe it into the input of another command
  (subshell) | command2

- place it into the command line arguments of another command
  command2 otherargs $(subshell)

- assign it to a shell variable
  foo=$(subshell)

-- 
Seth David Schoen <address@hidden>      |  No haiku patents
     http://www.loyalty.org/~schoen/        |  means I've no incentive to
  FD9A6AA28193A9F03D4BF4ADC11B36DC9C7DD150  |        -- Don Marti



reply via email to

[Prev in Thread] Current Thread [Next in Thread]