You are not logged in.

#1 2012-05-22 00:49:07

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

unable to sudo echo "text" >>file [solved]

I'd like to use echo to add line to foobar with sudo since foobar is owned by root.

$ sudo echo "new line" >>foobar
bash: foobar: Permission denied

Where is the error in my thinking?

EDIT: headsmack... the redirect is not running elevated.


$ sudo sh -c "echo 'new line' >>foobar"

Last edited by graysky (2012-05-22 00:53:44)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

Board footer

Powered by FluxBB