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.

4
  • Ok, so I'm looking for a 'universal' shebang. What about #!/usr/bin/env bash (see stackoverflow.com/questions/10376206/…) ? This line allows my script to be launched directly with fish. Commented Dec 29, 2018 at 7:14
  • 1
    @suizokukan: #!/usr/bin/env bash is only universal if every system you want to execute the script has bash installed. If you want portability, write your script to be compatible with POSIX standards. Then most shells will be able to execute it without issue (as most common shells are POSIX compliant). Commented Dec 29, 2018 at 7:31
  • 2
    POSIX scripts don't have the shebang, and since fish isn't POSIX-compatible it can't call them anyway (the premise of this question), so I'm not sure that helps Commented Dec 29, 2018 at 8:06
  • 2
    @MichaelHomer: POSIX scripts can have a shebang if you want them to. Since OP later asked for a ‘universal’ shebang, #!/bin/sh would be the way to go in my opinion. Commented Dec 29, 2018 at 9:20