Re: Weird issue, command output unable to pipe or capture

Lister <[email protected]>
Newsgroups gmane.org.user-groups.linux.svlug
Message-ID <[email protected]>

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.