Skip to content

Verification of the script preamble? #54

Open
@jstasiak

Description

@jstasiak

Hey! First of all thank you for this project, it's really helpful and I'm going to integrate it into our CI pipeline(s).

What I'm thinking about is I'd also like to verify that our bash scripts have

shopt -s nullglob globstar

and

if test "$BASH" = "" || "$BASH" -uc "a=();true \"\${a[@]}\"" 2>/dev/null; then
    # Bash 4.4, Zsh
    set -euo pipefail
else
    # Bash 4.3 and older chokes on empty arrays with set -u.
    set -eo pipefail
fi

at the beginning. Do you think there's place for this in shellharden (behind a flag, presumably)? I could open a PR if so.

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