この場合、以下のようにすると文字列を追加できる。
sudo bash -c "echo 'test' >> /etc/file"
sudo bash -cをpipeの後のコマンドもsudo権限で実行されるのか。なるほど。
参考:linux - Permission denied when trying to append a file to a root owned file with sudo - Stack Overflow
この場合、以下のようにすると文字列を追加できる。
sudo bash -c "echo 'test' >> /etc/file"
sudo bash -cをpipeの後のコマンドもsudo権限で実行されるのか。なるほど。
参考:linux - Permission denied when trying to append a file to a root owned file with sudo - Stack Overflow