“set -xe” in fish shell

bashfish

In bash, invoking set -x at the beginning of a script causes the commands to be printed on stdout while the script is executing. What's the equivalent syntax for the fish shell?

Best Answer

Fish's set command doesn't have that option.

However you could wrap set in your shell script. This would print the same format of output you're used to when placed at the top of a script.

function set; echo + set $argv; builtin set $argv; end

Alternatively, the function command has an --on-variable option that allows you to monitor particular variables for changes and have the function called automatically.

Or you can execute your fish script with fish -d 3 script.fish. This will print some tracing information.

Related Question