Force Zsh File Redirection
I get an error from zsh when I try to redirect to a file that exists. Simply add a !
to the >
to force it.
echo "new text" >! overwrite.file
According to this StackOverflow post you could also set noclobber
to clobber
, but I’m okay with the other answer which keeps the protection.