On Feb 1, 2:54 pm, Wardrop <t...@tomwardrop.com> wrote:
> Ok, this seems to work...
>
> (ns localhost.test)
>
> (clojure.main/main (println "Hello!"))
>
> I then assume I'd use the special form "do" to perform multiple
> unrelated tasks, such as...
>
> (clojure.main/main
>   (do
>     (println "Hello!") (println "Cheeso!")))
>
> At least I can now build and run a script.

Why are you including clojure.main stuff in your code?  So far as I'm
aware, one uses clojure.main as a means to start a repl, run a clojure
file, etc.  For example, I have the following bash script in a file
named "clj":

CLOJURE_JAR="/usr/local/clojure/clojure.jar"
CONTRIB_JAR="/usr/local/clojure/clojure-contrib.jar"
JLINE_JAR="/usr/local/jline/jline.jar"
CP=".:$CLOJURE_JAR:$CONTRIB_JAR:$JLINE_JAR"
if [ -z "$1" ]; then
        java -cp $CP jline.ConsoleRunner clojure.main
else
        scriptname=$1
        shift
        java -cp $CLOJURE_JAR clojure.main $scriptname $*
fi


With that in place, I can just run 'clj' from the command line to open
a repl, or execute a program, e.g.:
$ cat test.clj
(println *command-line-args*)
$ clj test.clj foo bar
(foo bar)

Then I can throw "#! /usr/bin/env clj" at the top of a clj file I want
to have it be executable.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to