How to make bash wrapper for java/groovy program with variable length arguments lists? | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

How to make bash wrapper for java/groovy program with variable length arguments lists?

Shell Programming and Scripting


Tags
argument list, bash, variable length

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 11-18-2010
siegfried siegfried is offline
Registered User
 
Join Date: Oct 2005
Last Activity: 18 August 2014, 3:01 PM EDT
Location: Bellevue, WA
Posts: 123
Thanks: 0
Thanked 0 Times in 0 Posts
How to make bash wrapper for java/groovy program with variable length arguments lists?

The following bash script does not work because the java/groovy code always thinks there are four arguments even if there are only 1 or 2. As you can see from my hideous backslashes, I am using cygwin bash on windows.


Code:
export CLASSPATH=${GROOVY_HOME}\\embeddable\\groovy-all-1.7.4.jar\;c:\\Documents\ and\ Settings\\a-sheintze\\My\ Documents\\eclipse-workspace\\js\\grep\\src\\siegfried\\bin\;.  
java siegfried.grep $1 $2 $3 $4

How can I fix this problem with bash or some other shell?

I would like to know how to fix this problem with cmd.exe but I fear this is the wrong forum for that! (If anyone knows, please let me know!)

Thanks,
siegfried

Last edited by siegfried; 11-18-2010 at 02:27 PM..
Sponsored Links
    #2  
Old 11-18-2010
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 29 August 2014, 9:07 PM EDT
Location: Saskatchewan
Posts: 19,271
Thanks: 774
Thanked 3,236 Times in 3,034 Posts
The special variable "$@" expands to all arguments, even when quoted like that. When not quoted, it might split on spaces in filenames, so keep it quoted just as shown.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to make 2 separate arguments in 1 bash script? guitarscn Shell Programming and Scripting 4 08-31-2010 05:12 PM
Make variable length record a fixed length jclanc8 Shell Programming and Scripting 3 10-03-2009 08:24 PM
Make a list in bash out of arguments jolecanard Shell Programming and Scripting 4 07-02-2009 04:23 PM
using a variable from java program in unix inquisitive101 UNIX for Dummies Questions & Answers 1 01-14-2009 08:24 AM



All times are GMT -4. The time now is 04:11 AM.