如何使用Clojure在命令行中更改目录? [英] How do I change directory in command line with Clojure?
问题描述
我正在寻找的是Windows命令行下的这种命令行交互:
What I'm looking for is this kind of command line interaction at the Windows command line:
C:\temp1>clj some_script.clj
C:\temp2>
其中some_script.clj包含以下内容:
Where some_script.clj contains something like:
(cd "c:\\temp2")
所以问题是 - 我如何实现函数cd?已经尝试过clojure.java.shell,但它看起来不像我需要的lib。这可能是一个简单的问题,问题可能是我不熟悉Java?
So the question is - how do I implement the function cd? Have experimented with clojure.java.shell, but it does not look like the lib I need. This might be a simple question, the problem might be that I'm not fluent in Java?!
推荐答案
在Java中这样做,所以你不能在Clojure中做到这一点。请参见 http://stackoverflow.com/questions/840190/changing-the-current -working-directory-in-java
You can't do this in Java, so you can't do it in Clojure. See http://stackoverflow.com/questions/840190/changing-the-current-working-directory-in-java
这篇关于如何使用Clojure在命令行中更改目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!