TIL: shell-redirections with sudo can be done. Just use sudo /bin/sh -c “echo ‘foobar’ > $file” How did I never had the idea to do it this way? 🤦♂️ Well everyday you learn something new. #linux #unix