Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change directory in command line with Clojure?

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>

Where some_script.clj contains something like:

(cd "c:\\temp2")

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?!

like image 293
Torbjørn Avatar asked Oct 13 '10 08:10

Torbjørn


People also ask

What command will change directory on command line?

The cd command, also known as chdir (change directory), is a command-line shell command used to change the current working directory in various operating systems. It can be used in shell scripts and batch files.

How do you change directory path?

Open the Command prompt, type in cd followed by the directory you want to move into, and hit Enter. Change the Windows directory by entering the drive name followed by : in the Command prompt, and hit Enter. In the Command prompt, type cd and drag the folder you want to move into from the GUI.

How do I run a Clojure code?

Create a new Clojure project with Leiningen. Build the project to create an executable JAR file. Execute the JAR file. Execute code in a Clojure REPL.

How do I change directory in Golang?

os. Chdir() is used to change the current working directory to the named directory in golang. It is similar to the cd command.


1 Answers

You can't do this in Java, so you can't do it in Clojure. See Changing the current working directory in Java?

like image 157
Stefan Tilkov Avatar answered Oct 06 '22 20:10

Stefan Tilkov