zsh z shell getting started on mac os
Mac OS Catalina comes with zsh installed.
If not installed on older versions, run this brew install to install zsh.
brew install zsh
Confirm zsh installation.
zsh --version
Check the default shell.
echo $SHELL
Create a global alias function in zsh.
a. Create a the file ~/.zshenv at your home root directory if it doesn’t already exist.
b. Add following to hellozsh function into this file ~/.zshenv
hellozsh() { echo 'hello zsh!' zsh --version echo $SHELL }
c. Run the following command to initialize the file ~/.zshenv
source ~/.zshenv
d. Run the function hellzsh defined in ~/.zshenv
hellozsh
Create a zsh script file and run it.
a. Create a file called helloworld.zsh
b. Add the following in the file created above.
#!/bin/zsh echo "Hello World!"
c. Make this file executable.
chmod +x helloworld.zsh
d. Run the zshell script helloworld.zsh
./helloworld.zsh
Search within Codexpedia
Custom Search
Search the entire web
Custom Search
Related Posts