Re: announcing: Blind and Low Vision Unix Users Group

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Didier Spaier <didier@xxxxxxxx> writes:

> As an aside, when writing shell scripts I now use only syntactical
> constructs
> specified by POSIX, so that they be portable across OS.

Building on your digression a bit: basically if a script has "#!/bin/sh"
in the shebang line, it should only use constructs from POSIX sh.  If it
needs bash or something else, it is best to require that in the shebang
line.  Bash et al are insanely portable, so it's fine to require them.
It's not fine to assume bash is /bin/sh, like so many Linux users did
for years.

There are some tools for detecting portability issues, namely shellcheck
and checkbashisms.  I use shellcheck because it's a general-purpose
linter for shell that will find and flag all kinds of other issues, not
just a tool to find nonportable constructs.

-- Chris




[Index of Archives]     [Linux for the Blind]     [Fedora Discussioin]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]

  Powered by Linux