2

I would like to ask if it is possible to set up in bash so that each command is executed from of the top of terminal window. In other words if it is possible to execute clear before each command.

Also I wonder if it is possible to do this without using preexec() hook since I have history disabled anyway in bash.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
D.K.
  • 29
  • 2

1 Answers1

0

You could do this on your bashrc:

export PROMPT_COMMAND="clear; $PROMPT_COMMAND"

According to the Bash manual:

PROMPT_COMMAND

If set, the value is interpreted as a command to execute before the printing of each primary prompt ($PS1).

So every time you press Enter to commit a command, Bash will clear the screen for you after executing the command. You won't be able to see the output of your commands though.