Many days ago, the zsh of my Arch Linux did what I want: if I entered `xsel` and pressed Tab, it would be replaced by the output of xsel. Now, on the same box, I get this:

xsel: fstat error on stdin: Bad file descriptor

What's more strange, I have setup another Arch Linux now, with the same zsh and config files. It just does this expansion right.

I write a simple script a to discover what happens to the stdin:

echo $(readlink /proc/self/fd/0)

Let's try again---`./a`, and press Tab. On the former box, I get


and on the latter which is what I want:


What should I do further to find out why they are different and get the expansion right?


I finally find out that this is caused by this zsh-history-substring-search script sosurced from my .zshrc when available. I still don't know why this happens, but I've opened an issue for this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.