在Scala中发出本机系统命令 [英] Issuing native system commands in Scala

查看:116
本文介绍了在Scala中发出本机系统命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从Scala程序发出本机系统命令,并可能陷阱输出。 (ls的想法,可能有其他方法获取目录信息,而不发出命令,但这是除了我的问题点。)它将对应于os.system(...)在Python。

I want to issue a native system command from a Scala program, and perhaps trap the output. ("ls" comes to mind. There may be other ways to get directory information without issuing the command, but that's beside the point of my question.) It would correspond to os.system(...) in Python.

我看过Scala编程。我看过O'Reilly的Programming Scala。我已经搜索了多个术语组合。没有运气。

I've looked in "Programming in Scala". I've looked in O'Reilly's "Programming Scala". I've Googled several combinations of terms. No luck yet. Can someone out there give me an example, or point me at a resource where I can find an example?

推荐答案

最好的方法是,找到一个可以找到一个例子的资源这是使用 scala.sys进程

Best way to do that is use scala.sys.process.

这篇关于在Scala中发出本机系统命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆