11

How can I print executed commands in fish shell?

I've tried solutions from In a shell script: echo shell commands as they are executed, but they are not compatible with fish shell.

Community
  • 1
  • 1
rominf
  • 2,719
  • 3
  • 21
  • 39

2 Answers2

10

Starting from fish-3.1.0, $fish_trace can be set to enable output similar to Bash’s set -x.

For example,

set fish_trace 1

before commands that should be traced.

Smar
  • 8,109
  • 3
  • 36
  • 48
4

Unfortunately fish doesn't yet have an analog of set -x to print commands. This is the issue requesting it. If you have ideas for what the syntax and output should be, please share them :)

The best answer today is, if you are trying to debug a problem you can invoke fish as fish -d 3 and it will show some debugging output as it runs.

ridiculous_fish
  • 17,273
  • 1
  • 54
  • 61