Skip to content

/bin/bash is not portable #29

@jirutka

Description

@jirutka

It’s wrong to assume that bash is installed in /bin or even installed at all – /bin/bash in shebang is not well portable. Using bash for every shell script is a bad practice that even caused several security issues in the history (that’s why Debian/Ubuntu now uses dash as /bin/sh). Bash is just one of many Shell language implementations and… just look under the hood of its development, into its source repository, you cannot seriously trust it…

You can safely assume that /bin/sh exists (specified in POSIX), as well as /usr/bin/env(the command itself is specified in POSIX, the path is not, but in practice, every *nix system has /usr/bin/env).

Please, don’t teach students that shell = bash, it’s a pretty bad practice.

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