CLI off-topic

rado84

Well-Known Member
Joined
Feb 25, 2019
Messages
1,091
Reaction score
934
Credits
8,411
In another topic @osprey said this:

Maybe the following works. It works with bash on debian here as shown on the command line. For persistence the PS1 code can be placed in .bashrc.
Code:
[ben@computer ~]$ PS1="[rado@resist] $"
[rado@resist] $

I decided to open a new topic, bc that other topic became a pool of off-topic. Whereas here in the CLI off-topic, we can discuss anything without clogging other topics.

Osprey's method (thanks for the idea, btw!) lacks something and PS1 simply takes the color of the regular text. So I asked an AI how to make it like the original. The AI gave me this code for ~/.bashrc (I put this at the very end of the file) which uses the user-defined colors in the terminal, so now it's practically indistinguishable from the original and nobody knows that the hostname is still "arch". :)

Code:
# Custom resist prompt in terminal, using the colors set by the user in the terminal config
PS1="$(tput setaf 2)[rado@$(tput setaf 7)resist$(tput setaf 2)]$(tput setaf 15): $(tput setaf 7)\w$(tput setaf 2)>\$$(tput sgr0) "

Picture_created_15-06-2026_00-28-44.png


terminal-colors.png
 


Isn't it better to discuss that in your ResistOS topic as you asked the question there, where @osprey replied to you?
The idea of this topic is to discuss anything CLI related that doesn't fit in any other topic. I think this matter falls under this term. This here is related to all CLI, not just mine, that's why it's here.
But if you think it's not OK to have an off-topic, delete it.

I discovered a bug with this method of replacing PS1, so I had to revert back to the original and I'll have to look for other ways. So if you delete this topic, it won't be a loss.
 


Follow Linux.org

Staff online

Members online


Latest posts

Top