Debugging bash scripts.
Ralf Mardorf
silver.bullet at zoho.com
Sat Feb 16 21:53:33 UTC 2019
On Sat, 16 Feb 2019 22:31:29 +0100, Ralf Mardorf wrote:
>On Sat, 16 Feb 2019 20:21:57 +0000, Mike Marchywka wrote:
>>But anyway my point was for debugging I just finally made methods for
>>everything- so for example none of the scripts will call "wget" but
>>rather have variables with values like "/foo/wget -q" or "/foo/wget -S
>>-v" depending on how debug flags are set. This let's you easily debug
>>for learning and dealing with unexpected web events.
>
>Indeed "verbose" options are more useful than "quite" options are and
>there are pitfalls when using "&&" (or "||"), since they not
>necessarily do the job, let alone "&", regarding race
>conditions, especially, if shell external commands and more especially,
>if special command, such as web related commands are used.
>
>For example
>
>man bash | grep wget
>
>returns absolutely nothing.
>
>Actually scripts are not a programming language. Are scripts a
>markup or interpretor languaben and what does it all mean related to a
>debugger? ;)!
Again, a script is a set of conditions to run programs, a script is not
a program. For my understanding it is reasonable to use a debugger to
check a program, but I don't understand how a debugger could be useful
to check a script.
JFTR if a log file should be wanted
2>&1
is standard Bourne/POSIX shell
it's said that
&>
does the job when using bash, I never tested it, actually redirecting
using
2>&1
works with bash, too.
More information about the ubuntu-users
mailing list