set -o xtrace
or
bash -x myscript.sh
This works with standard /bin/sh as well IIRC (it might be a POSIX thing then)
And remember, there is bashdb (bash Shell Debugger, release 4.0-0.4
)
To revert to normal, exit the subshell or
set +o xtrace
More Related Contents:
- Reading quoted/escaped arguments correctly from a string
- What is the cleanest way to ssh and run multiple commands in Bash?
- How can I do a recursive find/replace of a string with awk or sed?
- What is the purpose of “&&” in a shell command?
- How to avoid heredoc expanding variables? [duplicate]
- Bash script – store stderr in a variable [duplicate]
- How do I get bc(1) to print the leading zero?
- Bash command to sum a column of numbers [duplicate]
- Why can’t I use job control in a bash script?
- echo that outputs to stderr
- Bash if statement with multiple conditions throws an error
- How to show and update echo on same line
- printf in bash: “09” and “08” are invalid numbers, “07” and “06” are fine
- Explanation of colon operator in “: ${foo=value}”
- Bash indirect variable referencing
- Simulate user input in bash script [closed]
- How do I pause my shell script for a second before continuing?
- How do you echo a 4-digit Unicode character in Bash?
- Forking / Multi-Threaded Processes | Bash
- Check if image:tag combination already exists on docker hub
- bash getopts with multiple and mandatory options
- Why is #!/usr/bin/env bash superior to #!/bin/bash?
- Bash shell Decimal to Binary base 2 conversion
- Using conditional statements inside ‘expect’
- Root user/sudo equivalent in Cygwin?
- How to tell if a string is not defined in a Bash shell script
- BASH: Writing a Script to Recursively Travel a Directory of N Levels
- How to get the PID of a process in a pipeline
- How to parse a string with multiple characters to split on-Bash Scripting
- How to grep for case insensitive string in a file?