Is there an equivalent of POSIX shells' set -x or set -o xtrace that cause the shell to display the commands being run in the fish shell?


Not yet. You can use fish -p some_trace_file to run a fish session which outputs a profile to "some_trace_file", which can achieve almost the same effect.

| improve this answer | |
  • 1
    Thanks. That's useful indeed. The output is more readily usable than with -d4, and it gives that useful timing information and function call depth. One has to wait until the shell exits (and not die of a signal) though to get any of that output. – Stéphane Chazelas Nov 17 '15 at 15:23

The closest thing I can see, similar to set -o xtrace in zsh, by calling fish with -d 4 or --debug-level=4:

$ fish -d 4 -c 'echo 1'
fish: Exec job 'builtin source /usr/share/fish/config.fish 2>/dev/null' with id 1
fish: Exec job 'set -g IFS \n\ \t' with id 2
fish: Set status of set -g IFS \n\ \t to 0 using short circuit
fish: Job is constructed
fish: Continue job 2, gid 0 (set -g IFS \n\ \t), COMPLETED, NON-INTERACTIVE
fish: Exec job 'echo 1' with id 1
fish: Set status of echo 1 to 0 using short circuit
fish: Job is constructed
fish: Continue job 1, gid 0 (echo 1), COMPLETED, NON-INTERACTIVE
| improve this answer | |
  • Thanks. Those Set status of are only output for builtins though. You get more interesting output with -d4 (and piping to grep '^fish: Exec job' for instance) – Stéphane Chazelas Nov 17 '15 at 15:19
  • @StéphaneChazelas: yeah, of course, -d4 make it more similar to xtrace. – cuonglm Nov 17 '15 at 15:43

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.