在Elixir中运行Shell命令 [英] Run shell commands in Elixir

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

问题描述

我想通过我的Elixir代码执行一个程序。调用shell命令给定字符串的方法是什么?

I want to execute a program through my Elixir code. What is the method to call a shell command to a given string? Is there anything which isn't platform specific?

推荐答案

这里是如何执行不带参数的简单shell命令的方法:

Here is how you execute a simple shell command without arguments:

System.cmd("whoami", [])
# => {"lukas\n", 0}

查看有关 系统

这篇关于在Elixir中运行Shell命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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