Debugging bash scripts.

Ralf Mardorf silver.bullet at zoho.com
Sat Feb 16 16:11:35 UTC 2019


On Sat, 16 Feb 2019 16:58:38 +0100, Ralf Mardorf wrote:
>On Sat, 16 Feb 2019 15:33:43 +0000, Ian Bruntlett wrote:
>>I'm looking to have some kind of debugger to debug bash scripts.
>>
>>bashdb might be suitable but why isn't it in the usual package
>>repositories?  
>
>[weremouse at moonstudio ~]$ bash -c "help set" | grep '\-n'
>set: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
>      -n  Read commands but do not execute them.
>      -o option-name
>          Set the variable corresponding to option-name:
>              noexec       same as -n
>[weremouse at moonstudio ~]$ man bash | grep debugger
>       --debugger
>              Arrange for the debugger profile to be executed before
>the shell starts.  Turns on extended debugging mode (see the
>description of the extdebug option to the shopt  builtin If set,
>behavior intended for use by debuggers is enabled:
>
>However, running
>
>bash -n your_script
>
>checks the syntax but can't detect issues regarding some typos.
>IOW if you typed to execute "sl" instead of ls" and "ls" shouldn't be
                                                      ^^ this should
                                                      read "sl" *lol*


>provided by PATH or it should be by
>https://packages.ubuntu.com/cosmic/sl, the "-n" option doesn't help.
>
>I can't say anything about the "--debugger" option, actually I neither
>use "-n", nor "--debugger" to check my bash scripts.





More information about the ubuntu-users mailing list