Friday, February 1, 2019

run command with sudo with piping.



You can invoke a new shell as root:
sudo sh -c 'echo clock_hctosys=\"YES\" >> /etc/conf.d/hwclock'
You could also just elevate a process to write to the file:
sudo tee -a /etc/conf.d/hwclock > /dev/null << EOF
clock_hctosys="YES"
EOF


https://unix.stackexchange.com/questions/106663/how-to-run-a-command-that-involves-redirecting-or-piping-with-sudo


--30--

No comments:

Post a Comment