CHECKBASHISMS(1)

✨ CHECKBASHISMS(1) ✨

okay bestie, welcome to checkbashisms from the General Commands Manual section of your local man pages πŸ’– this is the lil tool that sniffs out bashisms hiding in your /bin/sh scripts, and yes she WILL call you out. lovingly. 🫢


🌸 NAME 🌸

checkbashisms β€” check for bashisms in /bin/sh scripts πŸ•΅οΈβ™€οΈβœ¨


πŸ¦‹ SYNOPSIS πŸ¦‹

checkbashisms script ...
checkbashisms --help|--version

πŸ’… DESCRIPTION πŸ’…

so like. checkbashisms is based on one of the checks from the lintian system, and what she does is run basic checks on your /bin/sh shell scripts to see if there's any possible bashisms lurking in there πŸ‘€ You hand her the names of the shell scripts on the command line, and she'll print warnings if she detects possible bashisms. that's it. that's the whole gig. she's very good at it.

ngl, the definition of a "bashism" here is roughly "a shell feature that is not required to be supported by POSIX" β€” which means some of the stuff she flags might actually be permitted under optional sections of POSIX, like XSI or User Portability. so don't come for her, she's just being thorough πŸ’€

and when POSIX and Debian Policy disagree?? checkbashisms by default allows the extensions that Policy permits, but she also has options for stricter checking if you're feeling brave. main character energy fr fr πŸ‘‘


πŸŽ€ OPTIONS πŸŽ€

  • --help, -h β€” show a summary of the options, for when you need a lil refresher ✨
  • --newline, -n β€” check for echo -n usage (non POSIX but required by Debian Policy 10.4.) 🚨
  • --posix, -p β€” check for issues which are non POSIX but required to be supported by Debian Policy 10.4 (this one implies -n) πŸ“œ
  • --force, -f β€” force each script to be checked, even if it would normally not be, for instance because it has a bash or non POSIX shell shebang or appears to be a shell wrapper. no skipping allowed, bestie πŸ’ͺ
  • --lint, -l β€” act like a linter, for integration into a text editor. possible bashisms will be printed in stdout, like so:
{filename}:{lineno}:1: warning: possible bashism; {explanation}
  • --extra, -x β€” highlight lines which, whilst they do not contain bashisms, may be useful in determining whether a particular issue is a false positive which may be ignored. for example, the use of $BASH_ENV may be preceded by checking whether $BASH is set. she's giving context, she's giving receipts πŸ”
  • --early-fail, -e β€” exit right after a first error is seen. no notes, she's out πŸšͺπŸ’¨
  • --version, -v β€” show version and copyright information πŸ“–

πŸ’€ EXIT VALUES πŸ’€

the exit value will be 0 if no possible bashisms or other problems were detected. slay πŸŽ‰

otherwise it'll be the sum of the following error values (yes, sum β€” they add up, so read carefully bestie):

  1. 1 β€” a possible bashism was detected 😭
  2. 2 β€” a file was skipped for some reason, for example because it was unreadable or not found. the warning message will give you the details πŸ”Ž
  3. 4 β€” no bashisms were detected in a bash script πŸ™ˆ

🌈 SEE ALSO 🌈

  • lintian(1) β€” go say hi to the mothership πŸ’œ

πŸ‘‘ AUTHOR πŸ‘‘

checkbashisms was originally written as a shell script by Yann Dirson <dirson@debian.org> and rewritten in Perl with many more features by Julian Gilbey <jdg@debian.org>. legends, both of them, no cap 🫢✨


and that's the whole page, bestie!! this one lives in the Debian Utilities corner of the Debian manual pages, filed under CHECKBASHISMS(1) β€” go forth and de-bashify your scripts, you absolute icon πŸŒŸπŸ’–