Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 2539

Raspberry Pi OS • Re: Xterm title and bash prompt

$
0
0
Murph9000 wrote:
It's unclear to me why you are persisting with the more complicated PROMPT_COMMAND solution, instead of the simpler PS1 solution, but you just need a little bash magic parameter expansion:

Code: Select all

murph@raspberrypi:~ $ title_prompt='\u@\h: \w'
murph@raspberrypi:~ $ echo ${title_prompt@P}
murph@raspberrypi: ~
murph@raspberrypi:~ $ cd tmp
murph@raspberrypi:~/tmp $ echo ${title_prompt@P}
murph@raspberrypi: ~/tmp
murph@raspberrypi:~/tmp $ cd /etc
murph@raspberrypi:/etc $ echo ${title_prompt@P}
murph@raspberrypi: /etc
murph@raspberrypi:/etc $
Thanks for the suggestion Murph9000. What I want is to have user@host: (Current working Directory) as the title of the terminal and "$ " as the prompt for the shell. Your solution is only addressing what happens to the shell prompt. That problem I have already solved. It is actually the default behavior at least in the version of Raspberry Pi OS I am running.
Thank you again.

Statistics: Posted by cimpi — Fri Sep 27, 2024 4:59 pm



Viewing all articles
Browse latest Browse all 2539

Trending Articles