You can debug a bash script like this:
bash -x script [arg1 ...]`
What is the fish
equivalent?
The debugging options available in the Bash shell can be switched on and off in multiple ways. Within scripts, we can either use the set command or add an option to the shebang line. However, another approach is to explicitly specify the debugging options in the command-line while executing the script.
The Korn shell provides a number of options that are useful in debugging scripts: noexec (–n), verbose (–v), and xtrace (–x). The noexec (–n) option causes commands to be read without being executed and is used to check for syntax errors. The verbose (–v) option causes the input to displayed as it is read.
Fish, or the “Friendly Interactive Shell,” is the most user-friendly and interactive shell, in my opinion. It is much more customizable than Zsh and Bash. It has a ton of cool features like consistent syntax, nice tab completion and syntax highlighting, is easy to pick up and use, and has excellent runtime help.
Fish use a similar flag system:
fish -d 3 script.fish
Where d
is the debug flag followed by the verbosity level:
-d or --debug-level=DEBUG_LEVEL specify the verbosity level of fish. A higher number means higher verbosity. The default level is 1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With