Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a bash script called "". I call it from another file like this: sudo sh /opt/ 400

I want to use the parameter "400" in like this: java -Xmx400MB -jar craftbukkit-beta.jar

I tried: java -Xmx"$(printf "$1")"MB -jar craftbukkit-beta.jar, but it did not worked.

Of course, without option -Xmx....MB it works perfectly.

Any ideas?

Thanks in advance.

share|improve this question
up vote 1 down vote accepted

Curly braces after the dollar sign allow you to expand a variable without putting spaces around it:

java -Xmx${1}MB -jar craftbukkit-beta.jar
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.