z icon indicating copy to clipboard operation
z copied to clipboard

Complicated stdout/stderr redirections

Open externl opened this issue 6 years ago • 0 comments

Currently, all output from _z is sent to stdout (https://github.com/rupa/z/blob/master/z.sh#L214).

alias ${_Z_CMD:-z}='_z 2>&1'

This was added here, presumably because some output (namely lists) was going to stderr

Moving inside the _z, lists are sorted and sent to stderr (https://github.com/rupa/z/blob/master/z.sh#L150).

cmd = "sort -n >&2"

After some digging, this was originally added a long time ago at https://github.com/rupa/z/blame/257f8400a79f9e82a952daf242fbb60483e42165/zz.sh#L6

# lists to stderr

There is also one other redirection, for the common: ... output form lists (which makes sense I think).

Maybe I'm missing something but shouldn't this sort -n >&2 redirection be removed and then possibly the 2>&1 redirection from the alias?

externl avatar Jan 19 '18 20:01 externl