Home
FreeBSD Tips
Sudo Tips
FreeBSD Tips
Sudo Tips | Sudo Tips |
|
|
|
If you need to use sudo and you need to redirect the result into a file with write permission only for root, you will get the following error: sudo echo '10.0.0.1 local.freebsdonline.com local' >> /etc/hosts Or if you need to run shell commands, say a simple change directory: $ pwd The command goes without an error buf after the command runs you realize that it did not work. This is due to the fact that you are trying to gain rigths for a shell that is alread started. The workaround for this is to run the commands in a sub-shell like this: sudo sh -c "echo '10.0.0.1 local.freebsdonline.com local' >> /etc/hosts" |
| < Prev | Next > |
|---|

