ohmybash / oh-my-bash

A delightful community-driven framework for managing your bash configuration, and an auto-update tool so that makes it easy to keep up with the latest updates from the community.
https://ohmybash.github.io
MIT License
5.53k stars 624 forks source link

The `DISABLE_UPDATE_PROMPT=true` on `~/.bashrc` doesn't work. #562

Closed mehdiMj-ir closed 2 months ago

mehdiMj-ir commented 2 months ago

I added this option to my servers and now ohmybash start asking me am I want to update my ohmybash instance or not! The server are Ubuntu 22.04, what other information may I provide for you?

akinomyoga commented 2 months ago

Where did you put the line? The DISABLE_UPDATE_PROMPT=true needs to be put before source "$OSH"/oh-my-bash.sh.

mehdiMj-ir commented 2 months ago

I used this Ansible ad-hoc command to add this at end of my ~/.bashrc

ansible all -m shell -a "echo "DISABLE_UPDATE_PROMPT=true" >> ~/.bashrc"

Doesn't logout and login do the source job and reread the configuration?

Maybe source "$OSH"/oh-my-bash.sh needs to be added to the documentation, should I apply for merge request?

akinomyoga commented 2 months ago

I used this Ansible ad-hoc command to add this at end of my ~/.bashrc

ansible all -m shell -a "echo "DISABLE_UPDATE_PROMPT=true" >> ~/.bashrc"

That doesn't work because it adds the line at the end of ~/.bashrc. You need to manually edit ~/.bashrc to add the line DISABLE_UPDATE_PROMPT=true before the line source "$OSH"/oh-my-bash.sh. Or you might think about some sophisticated ed or sed command to modify the file, but it is difficult to make it robust in general.

Doesn't logout and login do the source job and reread the configuration?

No. The variable DISABLE_UPDATE_PROMPT is set by ~/.bashrc, so when you login again the variable doesn't exist at the beginning. If you have DISABLE_UPDATE_PROMPT=true after source "$OSH"/oh-my-bash.sh in your ~/.bashrc, the variable is only set after "$OSH"/oh-my-bash.sh is sourced. Since the update check is performed inside source "$OSH"/oh-my-bash.sh, putting DISABLE_UPDATE_PROMPT=true after source "$OSH"/oh-my-bash.sh doesn't have any effect.

Maybe source "$OSH"/oh-my-bash.sh needs to be added to the documentation,

Maybe, but all those settings for OMB should be put before the line source "$OSH"/oh-my-bash.sh in ~/.bashrc.

should I apply for merge request?

mehdiMj-ir commented 2 months ago

I will put it after export OSH='/home/mehdi/.oh-my-bash' in .bashrc and I hope it's fine.

I will be glad if you add this to your documentation.

By saying apply for merge request I meant as help add this to your Readme/Documentation and now it looks like you got this yourself.

Thanks again for your great code, it helps me a lot :)