Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Comment (# char) behavior in the sub-shell



zsh version: 5.4.2

I'm heavy user of `#`-aliases, so I like to do stuff like `seq 1 10 #
9` to grep for `9` (`alias -g -- '#'='| grep'`).

It works as expected when I'm entering command in interactive mode
without sub-shell, like:

`$ seq 1 10 # 9` — works well, I see only `9` in the output.

But when I'm trying to use same alias in the sub-shell (e.g. inside
`$()`), it doesn't work anymore:

`$ echo $(seq 1 10 # 9)` — doesn't work, I see `1 2 3 ... 10` in the output.

It seems for whatever reason everything after `#` in the sub-shell is ignored.

I've tried to disable INTERACTIVE_COMMENTS option without any success.

`$ histchars='!^' ; echo $(seq 1 10 # 9)` produces expected output,
but it's obviously will break a lot of other things.

I think it's a bug, because user should see consistent behavior in the
same interactive session. It's easily reproducible with `zsh -df` and
alias definition as I wrote above.



Messages sorted by: Reverse Date, Date, Thread, Author