you are viewing a single comment's thread
view the rest of the comments
[–] 2 points 7 months ago* (1 child)

It's the index on 1 that ruins it for me.
Edit: come to think of it what would zsh print out for echo $0?

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 7 months ago

    It follows the same convention as most programming languages that expose the argument list. Python's sys.argv has the program name at index 0 and the first argument at index 1. C's char **argv does the same: index 0 is the program name, index 1 is the first argument. So it stands to reason that Zsh's $0 should be the program name and $1 should be the first argument...

    ...which, by the way, is exactly what Bash does as well.

  • source
  • parent