OliverJAsh Posted January 18, 2013 Share Posted January 18, 2013 I see /bin/bash as a language for shell scripts, but I don't see /bin/zsh. Is there any reason for this? zsh is quite popular… OliverJAsh 1 Link to comment Share on other sites More sharing options...
CarlosNZ Posted January 19, 2013 Share Posted January 19, 2013 Is zsh installed by default on OS X? If not, that'd be why. But you can always launch into another shell environment from within bash though, right? Link to comment Share on other sites More sharing options...
OliverJAsh Posted January 20, 2013 Author Share Posted January 20, 2013 You're right - you can launch it from within bash. I believe it is shipped with OS X. If I launch /bin/zsh from within bash, will it execute my zshrc, do you know? It's not finding any of the command-line utilities in my bins. Link to comment Share on other sites More sharing options...
CarlosNZ Posted January 20, 2013 Share Posted January 20, 2013 I believe Andrew has said that none of the user-specific environment settings are loaded when shell scripts run. This is to make them able to be transferred freely to other users without compatibility issues. You just have to make sure you call the full path rather than any aliases you have set up. For example, in my own (bash) scripts, I can't just use "growlnotify" like I normally would, I have to put the whole "/usr/local/bin/growlnotify" into my scripts. Personally, if it's a command I'm going to be using a lot, I just manually add an alias at the top of the script. Or just do a find-replace when you're done. ) OliverJAsh 1 Link to comment Share on other sites More sharing options...
OliverJAsh Posted January 20, 2013 Author Share Posted January 20, 2013 Perfect answer. Cheers! Link to comment Share on other sites More sharing options...
OliverJAsh Posted January 20, 2013 Author Share Posted January 20, 2013 Strangely, when I alias, I cannot execute the binary: #!/bin/zsh alias audiodevice="/Users/Oliver/.bin/audiodevice" audiodevice This doesn't work. Nothing is echoed, thus the `audiodevice` binary is not running. If I do this, however, it works: #!/bin/zsh /Users/Oliver/.bin/audiodevice Link to comment Share on other sites More sharing options...
CarlosNZ Posted January 20, 2013 Share Posted January 20, 2013 I don't know if it's the same for zsh, but for bash I discovered (thank you Google) that aliases aren't loaded by default when running scripts. I had to add this to the top of my scripts: #Enable aliases for this script shopt -s expand_aliases which did the trick. Hope that helps. OliverJAsh 1 Link to comment Share on other sites More sharing options...
OliverJAsh Posted January 20, 2013 Author Share Posted January 20, 2013 I don't know if it's the same for zsh, but for bash I discovered (thank you Google) that aliases aren't loaded by default when running scripts. I had to add this to the top of my scripts: #Enable aliases for this script shopt -s expand_aliases which did the trick. Hope that helps. Very helpful. Cheers. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now