On 6/16/20 10:13 PM, Dale R. Worley wrote:
> What a weird problem!  Yes, "hash -l" should produce output that can be
> read by bash.  But sending the "bash: hash table empty" message to
> stderr put you in the situation where "hash -l >file" doesn't really
> leave the output of "hash -l" in "file".  

Of course it would. The output of hash -l would be "bash-parseable code
to recreate the hash table", as in fact is currently documented. And
*diagnostic* messages are not output, and should not be treated as
output, and don't belong in that file one way or another.

If one really, truly wanted to collect both the expected output *and*
the diagnostic messages, one could redirect stderr too... but I don't
foresee this as being a problem. ;) People would be more likely to
redirect it to /dev/null.

> Maybe you could make the empty
> message be a comment?
> 
>     $ hash -l
>     # hash: hash table empty
> 
> That is acceptable input for bash, has the right effect when read by
> bash, is human-readable, and is capturable by redirecting stdout.

As I suggested, yes. :)

-- 
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to