I am using zsh as my shell and I am trying to achieve this:
In my .zshrc file I want to have a function that modifies my .zshrc, saves it and reloads it.
So far I have to functions (in my .zshrc file):
function zshrd(){
cp $HOME/config/.zshrc $HOME/
source $HOME/.zshrc
}
function zshed(){
message=${1:-Automated message}
nano $HOME/.zshrc
git add $HOME/config/
git commit -m $message
zshrd
}
Whenever I call zshrd it does work. But whenever I call zshed, it doesn't. It opens up the file in nano, but does not save any changes made to the file and does not commit anything. Maybe it has something to do with stdin/stdout?
Do you have any idea why? I am open to other solutions if I am doing things the "wrong way".
Thanks!