mhancoc7
September 20th, 2005, 11:44 AM
I am working on a little program with Gambas. I am a novice programmer.
I am using a script to open some of the common Linux configuration files such as menu.lst. I can successfully open the files with gedit, but they are Read/Only. I can't figure out how to run the script with sudo and have the password entered automatically either from a testbox in my app or just prompted for.
Can someone please help me with this. I would really appreciate it.
Here is my script so far.' Gambas class file
PUBLIC FUNCTION Call(cmd AS String) AS String
DIM result AS String
DIM s AS String
result = ""
s = Temp()
SHELL cmd WAIT
TRY result = file.Load(s)
TRY KILL s
RETURN result
END
PUBLIC SUB GrubEdit_Click()
PRINT Call("gedit /boot/grub/menu.lst")
END
PUBLIC SUB FstabEdit_Click()
PRINT Call("gedit /etc/fstab")
END
PUBLIC SUB ModulesEdit_Click()
PRINT Call("gedit /etc/modules")
END
God Bless and Thank you in advance, Jereme
I am using a script to open some of the common Linux configuration files such as menu.lst. I can successfully open the files with gedit, but they are Read/Only. I can't figure out how to run the script with sudo and have the password entered automatically either from a testbox in my app or just prompted for.
Can someone please help me with this. I would really appreciate it.
Here is my script so far.' Gambas class file
PUBLIC FUNCTION Call(cmd AS String) AS String
DIM result AS String
DIM s AS String
result = ""
s = Temp()
SHELL cmd WAIT
TRY result = file.Load(s)
TRY KILL s
RETURN result
END
PUBLIC SUB GrubEdit_Click()
PRINT Call("gedit /boot/grub/menu.lst")
END
PUBLIC SUB FstabEdit_Click()
PRINT Call("gedit /etc/fstab")
END
PUBLIC SUB ModulesEdit_Click()
PRINT Call("gedit /etc/modules")
END
God Bless and Thank you in advance, Jereme