bashrcgenerator | code source for bashrcgenerator.com
kandi X-RAY | bashrcgenerator Summary
kandi X-RAY | bashrcgenerator Summary
code source for bashrcgenerator.com.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of bashrcgenerator
bashrcgenerator Key Features
bashrcgenerator Examples and Code Snippets
Community Discussions
Trending Discussions on bashrcgenerator
QUESTION
To help myself remember that I am logged into a different system, quickly and visually, I use different colors for the \h
field in the Bash PS1
environment variable.
I am looking for a way to reliably generate the PS1
, tied to a static host-identifier; say, via the hostid
command.
Originally, my PS1
, which was adapted from something generated by bashrcgenerator.com, looked like:
ANSWER
Answered 2017-Mar-10 at 23:26Regarding colors this page helped me a lot to understand all details: http://misc.flogisoft.com/bash/tip_colors_and_formatting
Since there aren't so many colors to chose from one idea would be to simply assign a color to each of the host, and in case you have more hosts then group the hosts based on importance (dev, prod etc.) each group with it's own color.
There is also this idea to generate the color (from 1 to 256) using the checksum of the hostname: COLOR=$(($(hostname | cksum | cut -f1 -d" ")%256+1))
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install bashrcgenerator
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page