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?


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.