I'm trying to do a two-lines-script to temporary set a specific nameserver. Therefore I just output 'nameserver XXX.XXX.XXX.XXX'
to the /etc/resolv.conf
file, because it gets overwritten next time anyways. The thing is, when I try to ask for the password via gksudo, I get an error because it tries to output the gksudo result to the file.
UPDATE:
My current file is now:
#!/bin/sh
gksudo "bash -c \"echo 'nameserver XXX.XXX.XXX.XXX' >> /etc/resolv.conf\""
The command with sudo
instead of gksudo
and without the ""
and \\
works as it should. Remains how to get it into the GUI prompt.
-c
now as one of its options. :-/ – Peter Nerlich Jan 13 '15 at 16:09sudo
and without the "" and \ all around, butgksudo
won't. Strange... – Peter Nerlich Jan 13 '15 at 19:52