I'm trying to set it PS1so that it prints something right after logging in, but later a new line was added to it.
Suppose export PS1="\h:\W \u\$ ", therefore, for the first time (i.e. immediately after entering the system) you will receive:
hostname:~ username$
I am trying something like mine ~/.bashrc:
function __ps1_newline_login {
if [[ -n "${PS1_NEWLINE_LOGIN-}" ]]; then
PS1_NEWLINE_LOGIN=true
else
printf '\n'
fi
}
export PS1="\$(__ps1_newline_login)\h:\W \u\$ "
expecting to receive:
# <empty line>
hostname:~ username$
Full example from the beginning:
hostname:~ username$ ls `# notice: no empty line desired above!`
Desktop Documents
hostname:~ username$
source
share