2

My default shell is zsh (/bin/zsh). When I first open a terminal session, brace expansion for characters does not work, while numeric expansion works fine. Running zsh to open a new shell fixes the problem:

$ zsh --version
zsh 5.0.8 (x86_64-apple-darwin14.3.0)
$ echo {0..9}
0 1 2 3 4 5 6 7 8 9
$ echo {a..z}
{a..z} 
$ zsh
$ echo {a..z}
a b c d e f g h i j k l m n o p q r s t u v w x y z
$ zsh --version
zsh 5.0.8 (x86_64-apple-darwin14.3.0)

This occurs in both Terminal and iTerm, and is not due to any settings in .zshrc (it is unchanged in the absence of that file). The zsh version is the same in both cases, and is greater than 5.0.7, so this is not explained by this related question. I presume it's somehow related to the difference between a login/non-login shell, but I have no idea why it would do this.

Why isn't zsh performing brace expansion here?

Community
  • 1
  • 1
Sasgorilla
  • 2,403
  • 2
  • 29
  • 56
  • Possible duplicate of [(zsh brace expansion | seq) for character lists - how?](http://stackoverflow.com/questions/2394728/zsh-brace-expansion-seq-for-character-lists-how) – Eugene Sh. Feb 17 '16 at 19:13
  • 1
    Have you installed a new version of `zsh`? My `/bin/zsh` is 5.0.5 and does not expand `{a..z}`. My `/usr/local/bin/zsh` is 5.0.7 and does. – chepner Feb 17 '16 at 19:59
  • To expand on chepner's comment. Try `which zsh` to see which zsh is being executed. Then you can check the version on both with `--version` to compare... possibly a homebrew version? – Kevin Burdett Feb 17 '16 at 20:03
  • 1
    The doc of zsh v5.0.6 is the first to mention the brace expansion for characters, even though nothing is mentioned in the release notes. – Corubba Feb 17 '16 at 21:08
  • My zsh version is greater than 5.0.7 (both before and after the second zsh call), so this is not a duplicate of [(zsh brace expansion | seq) for character lists - how?](http://stackoverflow.com/questions/2394728/zsh-brace-expansion-seq-for-character-lists-how). Edited the question to reflect this. – Sasgorilla Feb 22 '16 at 14:29
  • @KevinBurdett calling `which zsh` inside the first session will not help. It is already established, that the first session starts the desired version of `zsh`. Instead compare the output of `echo $ZSH_VERSION` to see, whether it are indeed different versions. It is possible that either `PATH` did not include the desired directory when starting the first `zsh` (and it is only then updated by `zsh` itself) or *iTerm* and *Terminal* just call it with an absolute path (possibly from user settings?). If it is an absolute path `echo $0` should show it. – Adaephon Mar 02 '16 at 13:07

0 Answers0