Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • So the * acts as a regex expression? I thought that it was a special array... although surprise me that there is no such array... Commented Feb 9, 2019 at 1:59
  • wait, in zsh *[0] or *[1] gives me some file name... now I'm puzzled. Commented Feb 9, 2019 at 2:02
  • The array is $@... $* equals a single string with each argument separated by $IFS (usually space). ZSH and Bash doesn't handle usage of an "index" in space-delimited strings the same way. Commented Feb 9, 2019 at 3:19
  • Cristiano, the *[0] in zsh would expand to filenames that start with anything (or nothing) followed by any of the following characters: 0. The square brackets designates a set of characters in that position. You likely have files that end with a zero in your current directory. To tell zsh to give you back the first element of a * wildcard, you'd use parenthesis for array syntax: print -l *([1]) -- noting that zsh arrays start at 1 unless you set $KSH_ARRAYS Commented Feb 9, 2019 at 17:14