1

I have the following prompt:

PS1="\[\033[s\033[0;0H\033[0;41m\033[K\033[1;33mCWD:\w | \d | \t | CM: \# | \V\s\033[0m\033[u\]
<\[\033[0;32m\]\u@\h\[\033[0m\]>\$"

Everytime I type a command, it types a new line after. How can I remove it?

The output is:

prompt->ls
a.c b.c d.c

prompt->

And I want it to be

prompt->ls
a.c b.c d.c
prompt->

Can this be done, while keeping the initial text on the top.

1 Answers1

1

If you place the entire variable on one line then it does not add a new line after the prompt.

Tested and working on GNU bash, version 4.4.19 for RHEL 8.3

PS1="\[\033[s\033[0;0H\033[0;41m\033[K\033[1;33mCWD:\w | \d | \t | CM: \# | \V\s\033[0m\033[u\]<\[\033[0;32m\]\u@\h\[\033[0m\]>\$ "

<user@hostname>$ls a.txt b.txt <user@hostname>$