Check those shell scripts online!

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
Habitual

Check those shell scripts online!

Post by Habitual »

[url=http://www.shellcheck.net/]Shellcheck[/url] is a static analysis and linting tool for sh/bash scripts. It's mainly focused on handling typical beginner and intermediate level syntax errors and pitfalls where the shell just gives a cryptic error message or strange behavior, but it also reports on a few more advanced issues where corner cases can cause delayed failures.

Visual feedback on common scripting errors and syntax issues.
It's a Keeper!

Enjoy.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
jmdeking

Re: Check those shell scripts onliine!

Post by jmdeking »

Great site, gonna use it when in trouble scripting something :)
Habitual

Re: Check those shell scripts onliine!

Post by Habitual »

It is, but NOTE:
It likes to 'suggest' escaping some $(sub-shell) processes with "Quote this to prevent word splitting."

for example:

Code: Select all

ec2-copy-image -r us-east-1 --region us-west-2 -s $( awk 'NR==1 {print $2}' "$lst" ) -n "$td" -d "Daily ${suffix} backup" # 'bad substitution' "error" using ${suffix^}
but still, it's a Winner.
User avatar
xenopeek
Level 25
Level 25
Posts: 29595
Joined: Wed Jul 06, 2011 3:58 am

Re: Check those shell scripts onliine!

Post by xenopeek »

Might be handy, thanks! How did you stumble on this one :) The offline version is something I might be adding.
Image
Habitual

Re: Check those shell scripts onliine!

Post by Habitual »

xenopeek wrote:Might be handy, thanks! How did you stumble on this one :) The offline version is something I might be adding.
TBH, I'm not certain. I think I grokked it over at Ubuntuforums.org tooling around like I do, looking "under the hood" for challenges/solutions, you know ;)
Locked

Return to “Scripts & Bash”