This works for me. Maybe there's a problem with your "clj" script.
> And the results are this:
>
> "/Users/smith/src/no_spaces.txt"
> "~/file"
> "with"
> "spaces.txt"
>
> When they should be this:
>
> "/Users/smith/src/no_spaces.txt"
> "~/file with spaces.txt"
I get this:
$ clj /tmp/args.clj one two "three three three" four
"one"
"two"
"three three three"
"four"
Does this work for you?
(doseq [arg *command-line-args*]
(prn arg))
And this?
(ns args
(:use clojure.contrib.command-line))
(with-command-line ["one" "two two" "three"]
"args -- test of args"
[filenames]
(doseq [filename filenames]
(prn filename)))
My clj script basically does this:
java -server -cp "${CLASSPATH}" clojure.main "${script}" "$@"
The quotes are necessary around the $@, otherwise you will get the
symptoms you are seeing.
> P.S. Also, unrelated to this problem, the following line in the
> example code in command_line.clj is missing the vector surrounding the
> bindings of the doseq:
>
> :else (doseq filename filenames
That's the old syntax for doseq, so I suspect nobody remembered to
update the example.
--
Michael Wood <esio...@gmail.com>
Fixed, thanks.
--Chouser