Skip to content

bash scripts marked as sh #23

Description

@LukeSmithxyz

I noticed a number of these scripts are marked as #!/bin/sh, but still have some bashisms. I was running some on my system where I have sh linked to dash and had errors due to this (it would be the same on Ubuntu/Debian, where dash is default, I believe). I'd recommend running shellcheck on them all to be careful.

In general:

  • echo flags are not posix compliant, so it's best to use printf "%s" "$var" rather than echo -n "$var".
  • == is a bashism too, but it looks like a simple = would suffice in most places in these scripts.
  • [[ ]] are undefined in posix as well.

Again, shellcheck is the easiest way to know what's what. Otherwise, it's better to mark them as bash scripts.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions