Following is the function I have added in the .zshrc
configuration file to create a Notes folder if it does not exist and if the folder exists it has to cd to that folder.
function mnotes(){
if [ ! -d ~/Desktop/Notes ];then
mkdir ~/Desktop/Notes
else
cd ~/Desktop/Notes
}
I have set an alias as follows:
alias notes=mnotes
After sourcing the .zshrc
file. and typing the command notes, it will create the notes folder, but doesn't cd
into it if the folder exists.