Re: ssh stderr question

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

 



On 04/10/2017 01:42 PM, Jon LaBadie wrote:
> On Mon, Apr 10, 2017 at 01:29:59PM -0700, Rick Stevens wrote:
>> On 04/10/2017 12:46 PM, Gordon Messmer wrote:
> ...
>>
>> That's correct. In both examples, the commands inside the double quotes
>> and only what's inside the quotes are what's executed on the remote
>> system. Everything else is executed on the local system, thus these
>> three commands are entirely equivalent:
>>
>> 	ssh user_foo@1.2.3.4 "pgrep -f 'master_app' | wc -l" 2> stderr.log
>> 	ssh user_foo@1.2.3.4 2>stderr.log "pgrep -f 'master_app' | wc -l"
>> 	ssh 2>stderr.log user_foo@1.2.3.4 "pgrep -f 'master_app' | wc -l"
>>
>> In all three the redirection is done on ssh's stderr and it's written
>> to a "stderr.log" file in the current directory.
> 
> Might as well be complete:
> 
>   	2>stderr.log ssh user_foo@1.2.3.4 "pgrep -f 'master_app' | wc -l"
> 
> is also equivalent

Uhm, dunno about that one as you'd be redirecting stderr of the shell
itself--not the stderr of the ssh command ONLY. I also don't know if
that'd be treated like a non-exported environment variable (that only
lasts for the subshell's lifetime) or if it'd be sticky and you'd need
to restart your shell to get stderr for the shell back.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, AllDigital    ricks@xxxxxxxxxxxxxx -
- AIM/Skype: therps2        ICQ: 226437340           Yahoo: origrps2 -
-                                                                    -
-    When you don't know what to do, walk fast and look worried.     -
----------------------------------------------------------------------
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux