>> I just installed zsh recently and was working on making the switch >> over from bash for my daily user, provided I can get a few things >> worked out. >> >> The biggest problem that I can't find useful results googling is zsh >> interaction with sudo. >> >> I'm noticing some strange behavior with the PATH and also the >> interpretation of '='. >> [snip] >> So sudo has the PATH set correctly, but it doesn't actually use the >> correct path. Fishy! > > Nope. If you do > > sudo echo $PATH > > $PATH is replaced by the calling shell before sudo even sees it, so no wonder > you see the right one (btw, this should also answer your other question on why > doing the same on a second instance of the shell seems to "work"). > To test what path is seen when sudoing, do > > sudo zsh -c 'echo $PATH' > > that should be more accurate. But you already had an indication of what $PATH > is in your first command above.
Yes, that's true! > > This might be a good read about where to define PATH: > > http://zsh.sourceforge.net/FAQ/zshfaq03.html#l19 > >> As for interpretation of '=' I really don't understand what's >> happening. It seems indiscriminate of the case in terms of mucking >> about, but the exact result it not always the same. Consider the >> monstrous output in the following simple case of making a new >> environment variable: [snip] > This looks strange, and would indeed require more investigation. For some > reason, sudo is running /bin/env instead of erroring out (as no command to run > has been specified). However, I doubt that has anything to do with zsh. > >> Or if I want to emerge a specific package, instead I get: >> >> d...@flux log % sudo emerge =sudo-1.7.2_p2-r2 >> zsh: sudo-1.7.2_p2-r2 not found > > This is expected. See > > http://zsh.sourceforge.net/Doc/Release/Expansion.html#SEC78 > > "unsetopt EQUALS" > > should cure it. Unless, of course, you DO want to take advantage of zsh's > special handling of "=", in which case read the documentation. Excellent! > Zsh is a wonderfull shell, but it does have a steep learning curve, due to its > many features. Yes, you will bang your head on the wall many and many times if > you don't read the documentation and continue to think in bash terms. > Reading the manual (or the "user friendly" documentation) is a must. Zsh is an > example of an open source project with a massive and excellent documentation, > so no excuses for not reading it! :) Etaoin -- your response gave me probably all the tools and conviction I need. I should read documentation before hitting user lists, but I like the gentoo user list for good reasons. The notes about zsh are greatly appreciated, but as long as I command the ability to take the time to learn well documented things, then if nothing else, it's a great learning experience. Using gentoo for me is largely motivated by this personal philosophy, and I changed from bash not because I dislike it but because I wanted to try something new. For example, just reading your response I've learned more about how the path works that I didn't know. I'm over my head right now for other work that's more pressing, but it seems like I should be able to get zsh running properly by next week. Regarding Helmut's comment: > What is echo $SHELL saying? > Here, is says /bin/zsh > and your examples works just fine. This is a useful suggestion, but I had tried this and confirmed the same output you report. So the problem is buried deeper in my lack of knowledge about the operation of shells. Thanks! ~daid