shellcheck icon indicating copy to clipboard operation
shellcheck copied to clipboard

Feature request: warn if shell file depends on a shell option which is not enable by default to work

Open IceCodeNew opened this issue 3 years ago • 0 comments

For new checks and feature suggestions

  • [x] https://www.shellcheck.net/ (i.e. the latest commit) currently gives no useful warnings about this
  • [x] I searched through https://github.com/koalaman/shellcheck/issues and didn't find anything related

Here's a snippet or screenshot that shows the problem:


#!/bin/bash
$CONTAINERD_SELECTED && case $FOO_VERSION in
   # for ver 3.6.1, 3.7, 3.8.4.5, 3.9.0...
   "3.[6-9]*(.[0-9])" )
       CONTAINERD_VER='containerd://1.4.6' ;;
   # for ver 4.x
   "4.[0-9]*(.[0-9])" )
       CONTAINERD_VER='containerd://edge' ;;
   master )
       CONTAINERD_VER='containerd://1.4.6' ;;
   * )
       echo failed ;;
esac

echo $CONTAINERD_VER

Here's what shellcheck currently says:

No issues detected!

Here's what I wanted or expected to see:

Warn this shell file needs shell option extglob to be enabled so as to work.

IceCodeNew avatar Mar 28 '22 03:03 IceCodeNew