Is possible to call to sudo before of run a ruby statement (for that
can be run that statement)?
Hi Kless.
I think you’re talking about passing commands through the ‘system’
command.
How about something like this:
system(“sudo rm -rf /path/to/directory”)
James
On 18 oct, 15:47, James H. [email protected] wrote:
Hi Kless.
I think you’re talking about passing commands through the ‘system’ command.
How about something like this:system(“sudo rm -rf /path/to/directory”)
So, is not possible anything as: ?
Kless wrote:
So, is not possible anything as: ?
system(“sudo”)
FileUtils.mkdir_p(dir_root) unless File.exist?(dir_root)
No. The system command runs sudo in a shell - a separate executing
binary
image - and then throws away its context and returns. The commands then
run
without super-user support.
Now what’s the outer problem that makes you need sudo?
Now what’s the outer problem that makes you need sudo?
Create the ‘/usr/local/share/java’ directory if it isn’t already
created.
It was more easy to make:
dir_root = /usr/local/share/java
FileUtils.mkdir_p(dir_root) unless File.exist?(dir_root)
but I’m supposed that in this case I’ll have to make:
On 18 oct, 16:50, “Phlip” [email protected] wrote:
Kless wrote:
system(“sudo mkdir -p #{dir_root}”)
First, puts a string that advises the user why they might need to enter
their password.But shouldn’t you be using a high-level installer for Java itself?
No. I’ve to install anything JAR files in that directory.
Kless wrote:
system(“sudo mkdir -p #{dir_root}”)
First, puts a string that advises the user why they might need to enter
their password.
But shouldn’t you be using a high-level installer for Java itself?