How to scan a bash script (or a list of scripts), and detect which variables were defined but never read?
Asked
Active
Viewed 1,478 times
4
-
1possible duplicate of [Is there a static analysis tool like Lint or Perl::Critic for shell scripts?](http://stackoverflow.com/questions/3668665/is-there-a-static-analysis-tool-like-lint-or-perlcritic-for-shell-scripts) – Vorsprung Jan 01 '14 at 14:17
-
1reworded to fit the rules – dimid Jan 01 '14 at 16:42
-
It's still a duplicate – Vorsprung Jan 01 '14 at 17:41
-
1@Dimid Your question is more specific ("how do I find unused variables?"), but any answer to this would also be an appropriate answer to the question Vorsprung linked. Which basically means that there is no existing tool that does this. You might try writing one yourself (for scripts that don't do any wild variable munging it's pretty easy), and you could post a new question if you got stuck somewhere along that path. – Nathaniel Waisbrot Jan 02 '14 at 15:47