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

  • Home
  • SEARCH
  • 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 8287123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:56:59+00:00 2026-06-08T11:56:59+00:00

#!/bin/bash # this works: java ‘-XX:OnOutOfMemoryError=nohup bash -c service jira stop;service jira stop &’

  • 0
#!/bin/bash
# this works: java '-XX:OnOutOfMemoryError=nohup bash -c "service jira stop;service jira stop" &' -version
JVM_SUPPORT_RECOMMENDED_ARGS="" # WHAT TO PUT HERE !?! so the last line will execute the command above?
JAVA_OPTS=" ${JAVA_OPTS} ${JVM_REQUIRED_ARGS} ${DISABLE_NOTIFICATIONS} ${JVM_SUPPORT_RECOMMENDED_ARGS} ${JVM_EXTRA_ARGS} ${JIRA_HOME_MINUSD}"
set -x
java $JAVA_OPTS -version

If possible don’t touch other lines than the JVM_SUPPORT_RECOMMENDED_ARGS one.

  • 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-06-08T11:57:01+00:00Added an answer on June 8, 2026 at 11:57 am

    Although @raukh’s answer is right, i.e. you have to escape the ", you are also missing another point.

    Answer for the impatient: you need to add \" around ${JVM_SUPPORT_RECOMMENDED_ARGS} also, to prevent bash from separating the contents of JVM_SUPPORT_RECOMMENDED_ARGS to different argument.


    Complete answer:

    Imagine this example, assuming print_args is a program that echoes its arguments each in one line

    TEST="a b"
    ./print_args $TEST
    

    This will output a and b as separate arguments. This is because the " is removed and in fact the executed command is:

    ./print_args a b
    

    To make your command see your variable all as one parameter, you have to put it in ":

    TEST="a b"
    ./print_args "$TEST"
    

    Will show a b as one argument.

    Even if you write extra " in your string, it won’t work, as bash will separate the contents of the variable anyway:

    TEST="\"a b\""
    ./print_args $TEST
    

    will give you "a and b" as separate arguments. The only way you can handle this, is to add " where you use the variable, instead of where you define it.

    So in your case, the solution is this:

    JVM_SUPPORT_RECOMMENDED_ARGS="java '-XX:OnOutOfMemoryError=nohup bash -c \"service jira stop;service jira stop\" &' test"
    JAVA_OPTS=" ${JAVA_OPTS} ${JVM_REQUIRED_ARGS} ${DISABLE_NOTIFICATIONS} \"${JVM_SUPPORT_RECOMMENDED_ARGS}\" ${JVM_EXTRA_ARGS} ${JIRA_HOME_MINUSD}"
    

    The first line is as raukh suggested. The second line has added \" around ${JVM_SUPPORT_RECOMMENDED_ARGS}.


    If you want to test this, here is an example:

    test.c:
    
    #include <stdio.h>
    
    int main(int argc, char **argv)
    {
        int i;
        for (i = 0; i < argc; ++i)
            printf("%d: %s\n", i, argv[i]);
        return 0;
    }
    
    $ gcc -o print_args test.c
    
    $ TEST="java '-XX:OnOutOfMemoryError=nohup bash -c \"service jira stop;service jira stop\" &' test"; ./print_args $TEST
    0: ./print_args
    1: java
    2: '-XX:OnOutOfMemoryError=nohup
    3: bash
    4: -c
    5: "service
    6: jira
    7: stop;service
    8: jira
    9: stop"
    10: &'
    11: test
    
    $ TEST="java '-XX:OnOutOfMemoryError=nohup bash -c \"service jira stop;service jira stop\" &' test"; ./print_args "$TEST"
    0: ./print_args
    1: java '-XX:OnOutOfMemoryError=nohup bash -c "service jira stop;service jira stop" &' test
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this script: #!/bin/bash CLASSPATH=/blah/libs/*:/blah/more/libs CMD=java -cp $CLASSPATH MainClass ALREADY_RUNNING_PID=`ps -ef --no-headers |
I have this bash file: #/bin/bash PROP=-Dprop=foo bar java $PROP -jar Foo.jar So, what
This works fine when I run it by hand: #!/bin/bash eval `ssh-agent` ssh-add /usr/bin/scp
I want to understand how this Scala script works: #!/usr/bin/env bash exec scala $0
How can I make this code work? #!/bin/bash ARRAYNAME='FRUITS' FRUITS=( APPLE BANANA ORANGE )
On my Centos 6.2 I have this bash script: [le_me]$ cat get.nb #! /bin/bash
This code... #!/bin/bash cond=10; for i in {1..$cond} do echo hello; done ...just drives
Why is this script executing the string in the if statement: #!/bin/bash FILES=* STRING=''
I am working on a Bash shell script that does something like this: #!/bin/bash
For testing purposes I have this shell script #!/bin/bash echo $$ find / >/dev/null

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.