Pandora .pnd weirdness


Linux-SWAT

Forum Addict!
Joined
Feb 13, 2010
Messages
9,177
After having invoked gksudo via zenity, this command doesn't work :


sudo /bin/echo 'xserver_arguments -nolisten tcp' >> /etc/slim.conf


nor


sudo /bin/echo "xserver_arguments -nolisten tcp" >> /etc/slim.conf


Of course, other sudo commands worked :/
 
Last edited by a moderator:
It's an odd thing with sudo. The command executes with root access, but writing to the file does not fall under the root user, so you can't write to /etc/slim.conf as you're not root then.


The simplest thing to do is to 'sudo su' which will give you a shell as root. Then "/bin/echo "xserver_arguments -nolisten tcp" >> /etc/slim.conf" will work just fine.
 
The redirection of the output of programs is always done by the shell the command is executed with - if the target is a file, that file is opened by the shell and not by the executed programs. You can use tee to work around that issue when wanting to redirect into files, it'll simply write the input to a given file (-a to append).
 
Last edited by a moderator:
Ok, thanks.


sudo su in the script doesn't work.


How do tee works in this case ?
 
Last edited by a moderator:
How about Perl then? Maybe even inline Perl. It is present on Pandora, you can open file for writing and append the line, shouldn't meet this issue with redirecting output.


Hmm, tee should work fine.
 
Last edited by a moderator:
Code:
echo "xserver_arguments   -nolisten tcp" | sudo tee --append /etc/slim.conf

Did the trick !


Thanks all.
 
Oh oh oooooh, it's in a script. I thought you were just interactive bash-shelling away.


sudo su -c "/bin/echo xserver_arguments -nolisten tcp >> /etc/slim.conf" should work, executing the command as root.
 
Back
Top