shellcheck

(20)
vi a.sh
!#/bin/bash

echo {$1} ${2} "${3}"

if [ ${4} -eq "" ] ; then
  echo AAA
fi

sudo apt install shellcheck
shellcheck -V
shellcheck a.sh

-- bash -n a.sh

(10)
vi a.sh
!#/bin/bash

echo {$1} ${2} "${3}"

if [ ${4} -eq "" ] ; then
  echo AAA
fi

sudo apt install shellcheck
shellcheck -V
shellcheck a.sh

-- bash -n a.sh

 

(8)
https://www.hiroom2.com/centos-8-shellcheck-en/

vi a.sh
!#/bin/bash

echo {$1} ${2} "${3}"

if [ ${4} -eq "" ] ; then
  echo AAA
fi


dnf install -y glibc gmp libffi
wget -q -O - "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv
cp shellcheck-stable/shellcheck /usr/local/bin/
rm -rf shellcheck-stable

shellcheck -V
shellcheck a.sh

-- bash -n a.sh

 

(2019)
https://github.com/PowerShell/PSScriptAnalyzer
https://searchitoperations.techtarget.com/tutorial/Try-PSScriptAnalyzer-to-check-PowerShell-code-best-practices


Install-Module -Name PSScriptAnalyzer

Get-ScriptAnalyzerRule | Sort-Object RuleName | Select-Object CommonName

Invoke-ScriptAnalyzer .\a.ps1