you are viewing a single comment's thread
view the rest of the 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