rcaloras / bash-preexec

⚡ preexec and precmd functions for Bash just like Zsh.
MIT License
862 stars 94 forks source link

Line number exit outpu command ? #126

Closed gpxlnx closed 2 years ago

gpxlnx commented 2 years ago

Hey guys,

Is there any way to display, for example, the number of lines in the output of a command?

Ex.

$ ls 1 file1 2 arch2 3 arch3

dimo414 commented 2 years ago

There's the nl command, or equivalently a custom bit of Bash could do the same in a few lines, but I don't think there's any way to hook into the pipeline like this at the time(s) bash-preexec is running without somehow modifying the command itself.