[svlug] Weird issue, command output unable to pipe or capture
kevin dankwardt
kevin.dankwardt at gmail.com
Thu Apr 19 10:40:11 PDT 2018
|& is also handy so that stdout and stderr both go into the pipe.
as an example
$ strace -e open ls |& grep /lib
On Thu, Apr 19, 2018 at 8:53 AM, Robert Freiberger <rfreiberger at gmail.com>
wrote:
> That works!
>
> So I never knew that you could route the stderr after the > to a file. I'm
> going to refresh my knowledge of stdout and stderr but I was able to
> capture the output in a variable by using the foo=$(foo 2>&1). I honestly
> don't think I've encountered this before.
>
> Thanks again!
>
> On Wed, Apr 18, 2018 at 9:07 PM Lister <lister90 at bluehatsoft.com> wrote:
>
>>
>>
>> On 04/18/2018 09:01 PM, Robert Freiberger wrote:
>> > Hello,
>> >
>> > I've stumbled across a strange issue and wasn't sure if I'm
>> > overlooking something very simple. The problem is at work we have an
>> > application written in Ruby which is a wrapper for Chef knife command.
>> > It's pretty much taking the Chef environments from our Chef org and
>> > building a set of arguments.
>> >
>> > For example:
>> >
>> > $ foo dev-stage1 list
>> >
>> > This would use the Chef knife command to query the hosts in the
>> > dev-stage1 environment and list them out. The problem is the output
>> > does not allow me to pipe or capture in a bash variable "foo=$(foo
>> > dev-stage1 list)". Even something like "$ foo dev-stage1 list >
>> > /tmp/foo" doesn't work either.
>> Are you sure the command does not output to stderr?
>> You may try
>> $ foo > /tmp/foo 2>&1
>>
>> thanks
>> K
>>
> --
> Robert Freiberger
> 510-936-1210
>
> _______________________________________________
> svlug mailing list
> svlug at lists.svlug.org
> http://lists.svlug.org/lists/listinfo/svlug
>
>
--
visit www.kcomputing.com for the best in Linux developer training.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.svlug.org/archives/svlug/attachments/20180419/3f20ffaa/attachment.htm
More information about the svlug
mailing list