-
-
Save kazimmsyed/e3a852dfa53e96aed61656659545678c to your computer and use it in GitHub Desktop.
| % cat ~/.zlogin lily Patronus Fri 6 | |
| #setting mysql | |
| path[8]=/usr/local/mysql/bin; | |
| #Setting shell prompt | |
| PROMPT="%{$fg[yellow]%}%n@%m%{$reset_color%} %~"$'\n'"%# " | |
| #setting bindkey for mysql | |
| bindkey -s '^' "mysql -u root -p" |
All these hidden files resides on the $HOME
zshenv -> zprofile -> zlogin -> zshrc -> zlogout
Facts:
zshenv
Have a smaller zshenv file, so it opens quickly. Zshenv is for environment variables that ur entire file needs. So use it sparingly. Not suited for api keys. Rather use .zprofile and ".secret" files.
You can run scripts either using
source script.sh or ./scriph.sh
Shell inheritance
source creates another subshell. When a subshell is created zprofile, zlogin are skipped. This subshell is called non-login subshell because it was created by another shell, it has nothing to do about login and authentication. Since zprofile creates the shell environment, the env is inherited by the subshell, because of something known as shell inheritance. whereas, ./script.sh runs in the current shell.
Advice
Imagine a pie,
Majority party: is to keep majority of ur commands on zshrc like bindkey and environment variable setups by npm.
Competing party: is to keep the minority of setup files that is setting up environment variables in zprofile and important note is "shell environment is created in zprofile".
Other: zshenv or zlogin(optional).
% cat ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
#setting mysql
typeset -U path
`
path=( /usr/local/mysql/bin #Add your own PATH entries here #"$HOME/some/tool/bin" $path )
#Load personal secrets
[[ -f ~/.secrets ]] && source ~/.secrets
Uh oh!
There was an error while loading. Please reload this page.