bug-gnulib
[Top][All Lists]
Advanced

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

Re: noisy gnulib-tool on IRIX


From: Eric Blake
Subject: Re: noisy gnulib-tool on IRIX
Date: Tue, 07 Sep 2010 19:12:48 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.2

[adding bug-autoconf for a potential optimization]

On 09/07/2010 06:14 PM, Bruno Haible wrote:
Eric Blake wrote:
$ ./gnulib-tool --help 2>&1 | head -n3
alias: Not found
unalias: Not found
Usage: gnulib-tool --list

What happens if you replace the command

   unalias echo 2>/dev/null

The point is that IRIX /bin/sh lacks alias and unalias, so it treats it like any other command. And in general, it does command lookup prior to redirections, so directly redirecting to stderr does not squelch messages for missing commands; hence the common idiom of first checking if alias/unalias exist using a subshell check, and if so then using them in the parent shell.

What I wasn't sure about is why you were trying to set up an alias in the first place, nor how you plan on working around echo(1) issues without the use of alias(1).

Meanwhile, in answer to your question,

$ /bin/sh -c 'alias 2>/dev/null'
alias: Not found
$ /bin/sh -c '(alias) 2>/dev/null'
$ /bin/sh -c 'exec 3>&2; exec 2>/dev/null; unalias echo; exec 2>&3; exec 3>&-'
$

the indirect redirection of stderr prior to attempting the unfound command does indeed work to silence the message, without costing a subshell (hmm, maybe autoconf should use that trick to reduce forking at m4sh startup).

--
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]