Created
March 1, 2019 10:18
-
-
Save angelikatyborska/b22fd3ac81a8bf63873d810cb672637b to your computer and use it in GitHub Desktop.
Append to a 644 root owned file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# as sudoer, non-root: | |
echo 'foo' | sudo tee -a /etc/hosts | |
# or | |
sudo bash -c "echo 'foo' >> /etc/hosts" | |
# this does NOT work | |
sudo echo 'foo' >> /etc/hosts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This can be useful in a non-interactive shell like in a CI job.