Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bash; use hash mark in root prompt #469

Merged
merged 1 commit into from
Dec 12, 2022

Conversation

scop
Copy link
Contributor

@scop scop commented Nov 20, 2022

Proposed Changes

# for root, $ for non-root is a long standing tradition in bash and some other shells. Presenting $ for root is kind of dangerous as it causes incorrect assumptions about the powers at hand.

I don't know but I suppose /etc/profile.d snippets are loaded by zsh as well, but the zsh prompt looks quite different; I believe it gets rewritten later on on purpose. And maybe the hash vs dollar tradition isn't a thing for it in the first place, so this change should be good from that point of view.

@scop scop force-pushed the fix/root-bash-hash-prompt branch from 1f07eb2 to ac601c5 Compare November 20, 2022 07:32
@scop scop changed the title feat(bash): use hash mark in root prompt fix(bash): use hash mark in root prompt Nov 20, 2022
@frenck frenck changed the title fix(bash): use hash mark in root prompt Fix bash; use hash mark in root prompt Nov 20, 2022
@frenck
Copy link
Member

frenck commented Nov 20, 2022

Renamed the subject to be human instead of that horrible commit "Conventional Commits" specification. I wish that could be eradicated from the planet. We are humans, let's communicate as such.

@frenck frenck added the bugfix Inconsistencies or issues which will cause a problem for users or implementors. label Nov 20, 2022
@@ -1,4 +1,9 @@
export PS1='\W $ '
export PS1='\W'
if [ "${USER-}" = root ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are always root, not sure why this is needed in that case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are always root, except when we aren't :) For example, after a sudo -s -u hassio for whatever reason. Granted, it's rare, but I don't see why we wouldn't just do the right thing here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷 sure, ok

`#` for root, `$` for non-root is a long standing tradition in
bash. Presenting the dollar for root may lead to dangerous incorrect
assumptions.
@frenck frenck force-pushed the fix/root-bash-hash-prompt branch from ac601c5 to 7d25eef Compare December 11, 2022 18:03
@frenck frenck merged commit 4b5506c into hassio-addons:main Dec 12, 2022
@scop scop deleted the fix/root-bash-hash-prompt branch December 13, 2022 18:26
@github-actions github-actions bot locked and limited conversation to collaborators Dec 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bugfix Inconsistencies or issues which will cause a problem for users or implementors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants