3 ms·
The eval part of the script is unnecessarily versatile. I think a much simpler (and easier to understand) step is to ask user to relaunch their Terminal. Then
by noway421 5y ago
The eval part of the script is unnecessarily versatile. I think a much simpler (and easier to understand) step is to ask user to relaunch their Terminal.
Then the instruction becomes an easy 1 step task.
- TheRealPomax 5y ago"please lose your entire scroll buffer before this works, even though there's a way to use brew right now without doing that" isn't really going to win anyone favours. In cases like these: just ask the user what they want to do. > For brew to be available as command, brew needs to update your path and [bash/zsh/etc] profile. Please select how you wish to continue: > 1. Please do this for me > 2. Explain what you're about to do first, then ask me again. > 3. No thanks. I'll do this myself. And then you also make sure there's a runtime flag or even env var that can be used to override this, for admins who need to install brew as part of mass deploys.
- a1369209993 5y ago> please lose your entire scroll buffer before this works FWIW, some variation on: $ exec bash ought to work, since what you care about is restarting the shell (.bashrc,PATH,etc), rather than the terminal per se.
- snug 5y agoor source your profile $ source ~/.zshrc
- chisquared 5y agoSorry, but I cringe every time I see someone suggest this. Startup scripts often aren’t idempotent, and it takes work to make sure they are. Please don’t source your startup script unless you know what you’re doing.
- YetAnotherNick 5y agoAny examples of non idempotent script someone is likely to write? Because I can't think of much apart from doing some logging like 'user x logged at time y' which is likely to be fine to be written twice because it would be anyways if you open new terminal.
- snug 5y agoYeah i'd like to know some examples as well, I've never had a problem with this