newlisp exec你可以运行bash命令。但如何返回状态来运行它?
特别是,我需要监控hdfs dfs -test 结果返回。经过一番摸索,我发现了一个简单的答案:
#!/usr/bin/newlisp
(set 'x (exec "hdfs dfs -test -d /user/chenshu;echo $?
")) (println "x: " x) (exit)
输出结果:
x: ("0")
版权声明:本文博客原创文章,博客,未经同意,不得转载。
转载于:https://www.cnblogs.com/bhlsheji/p/4732282.html