1.3.0 permalink Arrow_down_16x16

*command-line-args*

clojure.core

A sequence of the supplied command line arguments, or nil if
none were supplied

1 Example top

  • ;; If you save this program as showargs.clj on a Unix-like system, then the
    ;; following command will produce the output shown.
    
    ;; % java -classpath clojure-1.2.0.jar clojure.main showargs.clj arg1 2 "whitespace in most command shells if you quote"
    ;; arg='arg1'
    ;; arg='2'
    ;; arg='whitespace in most command shells if you quote'
    ;; 
    ;; 
    ;; Second arg is string 2, not number 2.
    
    (ns com.demo.showargs)
    
    (doseq [arg *command-line-args*]
      (printf "arg='%s'\n" arg))
    
    (if (= "2" (second *command-line-args*))
      (println "\n\nSecond arg is string 2, not number 2."))
    
Log in to add / edit an example.

See Also top

Log in to add a see also.

Comments top

No comments for *command-line-args*. Log in to add a comment.