On 04/27/2012 05:12 AM, Stefan Berger wrote: > On 04/26/2012 05:13 PM, Eric Blake wrote: >> On 04/23/2012 06:20 AM, Stefan Berger wrote: >> >> >>> + if [ -n "${cmd}" ]; then >>> + eval "${cmd}" 2>&1 1>/dev/null >> This says output any errors from command to our stdout, and to ignore >> normal output of $cmd. Is that what you meant, or did you want to >> ignore both output and errors from $cmd, in which case you should swap >> the redirection operators? > > The intention was to not get any output from running those test > commands. Above unfortunately only solved this for stdout but not for > suppressing stderr, so 'ipset: command not found' was still printed. Now > I changed this line to > > eval "${cmd}" 2>/dev/null 1>/dev/null > > and everything is quiet. Not quite sure why the previous notation didn't > work... Using '2>&1 1>/dev/null' says: start with stdout (1) and stderr (2) inherited from the parent change fd 2 to be copied from the current fd 1 (the parents stdout) change fd 1 to be /dev/null now the child discards output, and sends errors into the parent's stdout Using '2>/dev/null 1>/dev/null' says: start with stdout and stderr inherited from the parent change fd 2 to be /dev/null change fd 1 to be /dev/null now the child discards everything Swapping the order, and using '>/dev/null 2>&1' says: start with stdout (1) and stderr (2) inherited from the parent change fd 1 to be /dev/null change fd 2 to be copied from the current fd 1 (/dev/null) now the child discards everything In other words, all you did wrong was forgetting that redirections are honored left-to-right. > I will post a V2. For this patch to go in I'll also need an ACK > for the somewhat longer patch for ipset support: > > http://www.redhat.com/archives/libvir-list/2012-April/msg01226.html Yep, on my list to review. -- Eric Blake eblake@xxxxxxxxxx +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list