ShellCheck


finds bugs in your shell scripts.
You can cabal, apt, dnf, pkg or brew install it locally right now.
Paste a script to try it out:
📄
Your Editor (Ace – loading 800kb of JS)
 
#!/bin/bash

#MANPATH="${MANPATH:-/usr/share/man}"

[[ "$1" =~ [0-9](|p|n|x) ]] && sec="$1" && shift

q="$1" && shift
#p="$(find "$MANPATH" -name "$q".[0-9].gz)"
p="$(find /usr/share/man/man*/ -name "$q".[0-9].gz|head -n 1)"
read -s -p $'\033[18t' -d t cup
col="${cup##*;}"

gzip -dc "$p" | awk -v ORS="" -v col="$col" -v t="1" '
function wrap(arg, width){
    for(p=0;p<=length(arg);p=p+(width-2)) {
        line=line substr(arg, p, width) "\n"
    }
    return line
}

BEGIN{ORS="";nr=1}
{while(wrap($0, (col+(t*8))))
 {RS="\n";T[0]="";{print T[t]}{for(i=1;i<6;i++) T[i]=T[i-1]" "}
    {skip=0
      {if($0~/(\\"|^\.if)/) {skip++}}
      {if($0~/^\.de/) { {while($0!~/^\.\./) {skip++;getline}} }}
    }
    {if(!(skip==0)) break}

    {if($1~/^\.TH/) {$1=""; print "\r" $0 "\n" T[t]; break}}
    {if($1~/^\.SH/) {$1=""; t=1; print "\n\r" $0 "\n" T[t]; break}}

    {if($1~/^\.TP/) {$1=""; t=($2^1); $2=""; print T[t] $0; break}}
    {if($1~/^\.PD/) {$1=""; t=($2^1); $2=""; print T[t] $0; break}}
    {if($1~/^\.(P|PP|LP|BR)/) {$1=""; print "\n" T[t]; break}}

    {
      {if($1~/^\.B/) {$1="";b="\x1b[35m"$0"\x1b[0m ";getline; print b$0}}
      {if($1~/^\.I/) {$1="";b="\x1b[96m"$0"\x1b[0m ";getline; print b$0}}
    #{if($1~/^\.B/) {RS="^\\.B"; print "\x1b[35m"$0"\x1b[0m ";next}}
    #{RS="^\\.I"; print "\x1b[33m"$0"\x1b[0m ";break}
    }

    {if($1~/^\.*/) $1=""}
    {print $0}
    {if(nr<NR) {nr++;getline} else {exit}}
}}

' | tr -d '\\' | awk '{if($0!="") print}'
📄
ShellCheck Output
If you paste a script in the editor above, this window will show shellcheck output.

ShellCheck is...

A special thanks to: GitpodBashSupport Pro Route4MeSiemensper1234cavcrosbydcminterphotostructureCronitorsteve-chavezChrLaucjgibsonCelebian LLC.org loves open source BestKru

Wiki Sitemap