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: Richard Taubo
Subject: Re: [Help-bash] Root access in subshell
Date: Tue, 4 Feb 2014 02:01:26 +0100

(sorry for the top posting)

I start to see things a little bit more clearly now.
Thanks  again for the information!

Best regards,
Richard Taubo

On Feb 4, 2014, at 1:18 AM, Bob Proulx <address@hidden> wrote:

> Richard Taubo wrote:
>> Bob Proulx wrote:
>>> That works just fine to "return feedback to the calling shell".  What
>>> more do you want?
>> 
>> I was trying to make a distinction between how the Find command run
>> in the main shell would show the result directly in the terminal,
>> whereas the result of a Find command in a subshell would have to be
>> set to a variable before the main shell could display the result in
>> the terminal.
>> 
>> Am I clearer, or is that just as bad?
> 
> Better.  :-)  The issue was "feedback".  In the above I now know you
> mean output from the program.  At least postulated it might be the
> exit code.  (Which is also returned.)
> 
>> in the main shell would show the result directly in the terminal,
>> whereas the result of a Find command in a subshell would have to be
>> set to a variable before the main shell could display the result in
>> the terminal.
> 
> If you want the output to go to the terminal (instead of back to the
> main shell) then instead of $(...) you want (...).  The $(...) runs a
> subshell and takes the stdout and replaces it on the command line.  As
> you say it does not show up to the terminal.  Instead it is handed
> back to the calling shell for handling.
> 
> If you use (...) instead then it will invoke a subshell.  The output
> is not redirected.  The output will go to the same place it would have
> gone without the subshell.  In that case though the main shell does
> not receive it as it is printed to the standard output aka the
> terminal.
> 
>  output=$(find / -user myuser)
> 
> Versus this:
> 
>  (find / -user myuser)
> 
> Both run in a subshell.  In the latter the output goes to the
> terminal.
> 
> However in the latter while there is no need for the subshell.  It
> might as well just be this:
> 
>  find / -user myuser




reply via email to

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