Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1006955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:32:39+00:00 2026-05-16T08:32:39+00:00

I make a clj script for running clojure as follows. java -cp $CLOJURE_JAR:$CLASSPATH clojure.main

  • 0

I make a clj script for running clojure as follows.

java -cp $CLOJURE_JAR:$CLASSPATH clojure.main $1

The problem is that $1 is the name of the script, so I can’t pass the argument with this.

The alternatives can be

java -cp $CLOJURE_JAR:$CLASSPATH clojure.main $1 $2 $3 $4 $5

hoping that the number of arguments is less than four, which might work, but I guess there should be a better solution to this.

What would be the better way than this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T08:32:40+00:00Added an answer on May 16, 2026 at 8:32 am

    You can use $@ to pass on all CLI arguments received by your script:

    #!/bin/sh
    java -cp $CLOJURE_JAR:$CLASSPATH clojure.main $@
    

    If you want to omit some initial arguments, you can use e.g. shift, which drops the current value of $1 and shifts the remaining arguments so that $1 assumes the old value of $2, $2 that of $3 etc.:

    #!/bin/sh
    # prints out the first CLI argument, then passes the rest on to clojure.main
    echo $1
    shift
    java -cp $CLOJURE_JAR:$CLASSPATH clojure.main $@
    

    For related information, see the section entitled Special Parameters in bash‘s manpage.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make connect clojure to mysql, but somehow fail. My project.clj
SOLUTION Make sure in the plist that the storyboard name is listed as the
I make some script, that have modal window on fancybox and on load it's
I'm trying to make a function in Clojure that is local to the body
I'm looking for any way for clojure that can trigger an event at a
make /bin/sh /Users/myusername/Downloads/php-5.3.5/ext/mssql/libtool --mode=compile cc -I. -I/Users/myusername/Downloads/php-5.3.5/ext/mssql -DPHP_ATOM_INC -I/Users/myusername/Downloads/php-5.3.5/ext/mssql/include -I/Users/myusername/Downloads/php-5.3.5/ext/mssql/main -I/Users/myusername/Downloads/php-5.3.5/ext/mssql -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM
I make an app that have to printing image. I need to print image
I wish to enable user defined Clojure scripts to interact with my Java App.
I am trying to load the Clojure library for RDF clj-plaza in Clojure REPL
Make things as simple as possible, but no simpler. Can we find the solution/s

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.