β² 378 βΌ it's just the worst (lemmy.world) submitted 7 months ago by kali_fornication@lemmy.world to c/linuxmemes@lemmy.world 188 comments fedilink hide all child comments
[β] uid0gid0@lemmy.world 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? permalink fedilink source parent hideshow 2 child comments replies: [β] rtxn@lemmy.world 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. permalink fedilink source parent
[β] rtxn@lemmy.world 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. permalink fedilink source parent