Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 3
    There's shellcheck, but as a general rule, if you have bash scripts that are hundreds of lines long you should almost certainly be using a proper programming language and not a shell. The shell isn't made for this sort of thing. Commented Oct 5, 2021 at 21:28
  • Thanks for shellcheck. I don't do extended logic with bash, none of my functions are more than say 30 lines long. There is utility in bash being "always there" and being the interface that I interact with a system, so I've never bought into that whole "bash bashing philosophy" of saying that bash is not a "proper language"; it has a lot of utility. I use other languages too (python, powershell, c#). My 1,000+ line bash scripts are sets of useful day to day functions that I use frequently. Commented Oct 6, 2021 at 6:07
  • 1
    To me, needing a shell script debugger is something that implies you're doing debugging far too late in the process. It seems that employing an iterative way of writing shell scripts may be helpful to you. Don't expect to write a script that does what it's supposed to do, all at once. Instead, write an empty main loop and just make sure it iterates over the right things. Then add extraction of one piece of data, or whatever you need to do next, and make sure that bit works, testing after adding each new "feature" of the code. Commented Oct 6, 2021 at 9:56
  • I do all that, to the extent that I can, but over time, things happen, time constraints, jumping between projects. Unfortunately, "life happens", and things creep in, so debugging something is required in those situations. Commented Oct 6, 2021 at 11:26
  • The issues you are describing in the first paragraph are typical of all programming languages, e.g. C. A missing round bracket will cause an error to be thrown many lines of codes later. Commented Oct 6, 2021 at 12:39