Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 10-31-2009, 11:35 AM   #1
Registered: Jan 2005
Distribution: Archlinux, Debian, Centos
Posts: 219

Rep: Reputation: 33
Finding bugs in bash scripts, Analyis tool for bash

Is there a tool available to verify shell scripts? As an example for other languages like Java there exist some nice tools to integrate into eclipse(, like PMD). Source code analysis

The Java compiler itself checks for several issues.

They find 'patterns of errors' which should be avoided, something like:
- obsolete API call used
- return value not used
- etc.
Old 10-31-2009, 12:06 PM   #2
Amigo developer
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,882

Rep: Reputation: 567Reputation: 567Reputation: 567Reputation: 567Reputation: 567Reputation: 567
The bash debugger:
Old 10-31-2009, 12:42 PM   #3
Senior Member
Registered: Jul 2005
Distribution: Slackware
Posts: 2,014

Rep: Reputation: 115Reputation: 115
I use this to sanitize the environment:
   source "/etc/profile" > /dev/null
   set -eu
   shopt -s nullglob dotglob
   umask 022
   unalias -a
   unset -f $(declare -F | sed "s/^declare -f //")
set -eu is a huge step towards writing reliable and robust bash scripts by using the "fail fast" approach.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Bash scripts greengrocer Linux - Newbie 16 06-04-2009 09:59 AM
Need some help with BASH scripts mcdcyex Linux - Newbie 13 04-01-2008 12:50 PM
I need some help with BASH scripts. BoB4ik Programming 10 12-20-2007 05:06 PM
$? in Bash scripts clinton Linux - Newbie 4 02-20-2004 12:15 PM
Bash scripts? BajaNick Programming 3 07-05-2003 11:13 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:08 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration