Is there any way to configure Bash to print a newline or horizontal line after commands that provided more than N lines of output? For instance, after a simple cd
I don't need a newline or horizontal line, but after a long cat
a visual indication of the end of each command's output would be great when I am comparing the output of various commands.
This cannot be done in bash. The program's output to the terminal does not pass through shell (bash), so there is no way for bash to determine how many lines were printed.
Personally I just manually hit enter once or twice in case when I need visual separation. If you would like to have a newline on every command, the best way is to
export PS1='\n'"$PS1"
Actually you could use a wrapper script like the one below:
Save it in your homedir, lets say as a ~/wrapper.sh. Make alias for it in your .bashrc file:
Now you can invoke command of your choice with 'wrap' prefix:
stdout from your command will be post-processed by the wrapper.sh (I'm adding horizontal line after each 1o lines)