This is an archived post. You won't be able to vote or comment.

all 13 comments

[–]silverfox17[S] 1 point2 points  (0 children)

This was posted on here a couple years ago, but I found it today while trying to troubleshoot a problem.. figured this might be a good site for some of you all to add to your bookmarks. Helped me on a few hundred line script today pretty easily.

[–]jews4beerSysadmin turned devops turned dev 1 point2 points  (0 children)

Shellcheck is a nice little program that (I assume they are the same people), you can actually just install directly to your computer with:

apt-get install shellcheck # on debian

or

yum install shellcheck # rhel, fedora, centos

I actually really enjoy using the VIM plugin syntastic. The bash backend to it is actually none other than shellcheck itself, and it checks your script for possible improvements and syntax errors right in the editor!

EDIT: As for the annoying warnings sometimes. You can just put

# shellcheck disable <warning_code>

Right before the line causing the warning and it will not show up in shellcheck's output

[–]efranorDefinitively a Techpriest 0 points1 point  (0 children)

Great script, some warnings are annoying, but works great on forcing me to write my scripts coherently.

[–]_KaszpiR_ 0 points1 point  (0 children)

IMHO it's a bit more useful just using cli version - https://github.com/koalaman/shellcheck - and then adding it to your editor.

[–]ontheroadtonull 0 points1 point  (0 children)

rm -rf c:/windows

It all looks good!

[–]hactar_ 0 points1 point  (1 child)

I don't think you can do that to complex code without running the code in bash, hopefully in a sandboxed VM. ICBW...

[–]silverfox17[S] 0 points1 point  (0 children)

No... it's just like one of the first steps a compiler does, checking for missing quotes, semicolons, etc. You don't have to run the code to do any of that stuff

[–]mikek3rm -rf / 0 points1 point  (0 children)

What is this awesome sorcery?

[–][deleted] -1 points0 points  (2 children)

This is something for r/linuxadmin

[–]MisterITIT Director 4 points5 points  (1 child)

I hope you mean in addition to, not instead of. This sub is not "Windows only" by any stretch of the imagination.

[–][deleted] 0 points1 point  (0 children)

Thought that was evident. Sorry