0

Should I start my ZSH scripts with #!/usr/bin/env zsh, or #!/bin/zsh, or what? This seems like a very Google-able problem, but I haven't been able to find any information of what's the best option.

5
  • Both work. Which practical problem are you trying to solve here?
    – nohillside
    Aug 4 at 23:02
  • ...the practical problem of writing a script and wanting it to follow good practices and continue working in the future? Aug 4 at 23:04
  • 4
    Apple isn't likely to move the shells, but if you want your script to be transportable between Unix-like systems, you might want to use env, because not all systems are going to put the shell you want to use in /bin. Also consider whether you are, or should be, writing scripts that depend on zsh. Aug 4 at 23:13
  • Depends what you want to achieve: Do you want to explicitly specify the location of zsh, or do you want to use the first one which is in your PATH? The difference matters, if either your script is running on different computers, or if you have several zsh versions installed. Aug 5 at 8:32

0

Browse other questions tagged .