Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Printing executed commands

Tags:

shell

unix

fish

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.

like image 605
rominf Avatar asked Dec 08 '15 08:12

rominf


People also ask

What is printing command in Linux?

Printing from the Linux command line is easy. You use the lp command to request a print, and lpq to see what print jobs are in the queue, but things get a little more complicated when you want to print double-sided or use portrait mode.

How do I print a Unix statement?

Specify the fileref from your FILENAME statement or FILENAME function. Issue the PRINT command from the command line of the windows whose contents you want to print. If you are sending output to a system printer or if you are using forms-based printing, then you can print the contents of more than one window.

How shell commands are executed?

The shell parses the command line and finds the program to execute. It passes any options and arguments to the program as part of a new process for the command such as ps above. While the process is running ps above the shell waits for the process to complete. The shell is in a sleep state.


2 Answers

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.

like image 167
Smar Avatar answered Sep 20 '22 10:09

Smar


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.

like image 45
ridiculous_fish Avatar answered Sep 21 '22 10:09

ridiculous_fish