本文介绍了是否有任何图形化的"sudo"?对于Mac OS X?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用Java设计一个小的软件.我不知道我在做什么的术语/定义,但是我正在提示从Java到终端的命令.像这样:

I'm designing a little software in Java. I don't know the term/definition to what I'm doing, but I'm prompting commands from Java to the terminal. Something like this:

Process process = Runtime.getRuntime().exec("command");

我以前在Linux中已经做到了,并且我将gksudo用于需要root密码的命令.

I've done this before in Linux, and I used gksudo for commands that required the root password.

OS X中是否有任何gksudo?是否有任何图形化弹出窗口要求输入root密码?

Is there any gksudo in OS X? Any graphical popup asking for root password?

推荐答案

使用AppleScript Shell脚本,您可以花更少的精力编写自己的脚本:

You can more ore less manage to write your own with an AppleScript shell script:

#!/bin/sh
osascript -e "do shell script \"$*\" with administrator privileges"

cocoasudo 从外观上看更令人愉悦,但这已被部署.

cocoasudo looks aesthetically more pleasing, but this is already deployed.

这篇关于是否有任何图形化的"sudo"?对于Mac OS X?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 18:00