Breakpoints

Breakpoints in Bash scripts work just like any other type of breakpoint in your IDE.

Only line breakpoints are supported. You can not set breakpoints on empty lines.

A breakpoint is only stopping execution for the first instruction on a line. You can’t step over multiple instructions on the same line.

How to Set Breakpoints

The easiest way to set a new breakpoint is to use the gutter on the left:

Bash script without breakpoint
Bash script without breakpoint

Click into the empty space on the left. Now the new breakpoint is displayed like this:

Bash script with a breakpoint
Bash script with a breakpoint

Once you start the debugger, an active breakpoint displays an additional check mark:

Bash script with an active breakpoint
Bash script with an active breakpoint

How to Remove Breakpoints

You can just click on the breakpoint icon to remove it. Alternatively, you can use the breakpoint settings dialog to manage all breakpoints at once.

Conditional Breakpoints

A conditional breakpoint only stops the execution when the conditional evaluates to true.

To set a condition on a breakpoint:

  1. Right–click on the breakpoint icon
  2. Enter the condition into the text input field
  3. Close the popup to apply the settings
How to configure a conditional breakpoint in BashSupport pro
How to configure a conditional breakpoint in BashSupport pro

A conditional breakpoint is marked with a question mark:

An active, conditional breakpoint is marked with an additional check mark:

Examples of conditional breakpoints
The script stops at the breakpoint when the condition evaluates to true (i.e. 0). Here are a few examples:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# stop execution when the value of $name equals "foo"
test $name = "foo"
# same as above
[ $name = "foo" ]

# stop execution when the value of $name begins with "fo"
[[ $name =~ "fo" ]]

# stop execution when the value of $num is a number greater than 120
[[ $num -gt 120 ]]
Conditional breakpoints in BashSupport Pro
Conditional breakpoints in BashSupport Pro

Temporary Breakpoints

A temporary breakpoint is removed as soon as it’s hit.

  1. Right-click on a breakpoint
  2. Mark the checkbox Remove after first hit (temporary breakpoint)
A temporary breakpoint in BashSupport Pro
A temporary breakpoint in BashSupport Pro

Breakpoint Settings

Your IDE provides a list of the breakpoints. This dialog also allows you to configure the properties of each breakpoint.

Breakpoint settings dialog
Breakpoint settings dialog
© 2020–2024 Joachim Ansorg
Imprint
Privacy Policy
Legal