In order to let the prompt first shows the hostname and path in one line, then starts a new line and allows users to insert a command. I set the PS1 value to '\[H] \W \$ '`echo -e "\n"`, that is:
then I get a prompt like this:
the new line seems does not work in PS1, but if I change it to
the corresponding prompt becomes
Can some one explain why the tail '+' helps the new line show in the terminal?
And the new prompt seems to cannot handle a long command correctly. That is if the command is longer than the length of a terminal, then the command will not be shown correctly once we use historic record (up arrow or down arrow in keyboard) to type it again.
Code:
PS1='[\H] \W \$ '`echo -e "\n"`
Code:
[FreeBSD] /root/work # somecommand
Code:
PS1='[\H] \W \$ '`echo -e "\n+ "`
Code:
[FreeBSD] /root/work #
+ somecommand
And the new prompt seems to cannot handle a long command correctly. That is if the command is longer than the length of a terminal, then the command will not be shown correctly once we use historic record (up arrow or down arrow in keyboard) to type it again.