On Fri, Feb 2, 2018 at 11:43 AM, George Linn via smartos-discuss
<smartos-discuss@lists.smartos.org> wrote:
> The following does not work:
> /usr/sbin/vmadm create -f /opt/json_to_create_vm |  /usr/bin/cut -d" " -f7
> I can grep and cut output from “vmadm list” but neither cut or grep works on 
> “vmadm create -f”.
> Is the issue that “vmadm create -f” creates additional processes and writes 
> text to the screen that grep and cut process don’t have access to?

This is because `vmadm create` prints the message to stderr. If you
want to capture it, you will need to redirect stderr to stdout. Of
course, if you did this, then you might lose any information about a
failure to cut, so you'd probably want to beef up your script to first
save the output, check the exit code, and then extract the uuid from
the message if vmadm succeeded, or print the message if it failed.

- Cody

Archives: https://www.listbox.com/member/archive/184463/=now
RSS Feed: https://www.listbox.com/member/archive/rss/184463/25769125-55cfbc00
Modify Your Subscription: 
Powered by Listbox: http://www.listbox.com

Reply via email to