Exit with error from subshellUnable to run java file from command like UbuntuAttempting to GREP details of a...

Is "the fire consumed everything on its way" correct?

In Linux what happens if 1000 files in a directory are moved to another location while another 300 files were added to the source directory?

A Missing Symbol for This Logo

Globe trotting Grandpa. Where is he going next?

Why are all my replica super soldiers young adults or old teenagers?

Why do we have to make "peinlich" start with a capital letter and also end with -s in this sentence?

What will happen if Parliament votes "no" on each of the Brexit-related votes to be held on the 12th, 13th and 14th of March?

Short story where statues have their heads replaced by those of carved insect heads

Why are the books in the Game of Thrones citadel library shelved spine inwards?

What is the difference between rolling more dice versus fewer dice?

How do you voice extended chords?

How can the probability of a fumble decrease linearly with more dice?

How do I prevent a homebrew Grappling Hook feature from trivializing Tomb of Annihilation?

How to politely refuse in-office gym instructor for steroids and protein

After checking in online, how do I know whether I need to go show my passport at airport check-in?

Saint abbreviation

What makes papers publishable in top-tier journals?

Why would space fleets be aligned?

Citing paywalled articles accessed via illegal web sharing

Hilchos Shabbos English Sefer

Is using an 'empty' metaphor considered bad style?

Can I announce prefix 161.117.25.0/24 even though I don't have all of /24 IPs?

What happens when I Twin Life Transference?

What language shall they sing in?



Exit with error from subshell


Unable to run java file from command like UbuntuAttempting to GREP details of a Java errorHow to set the environment variabile using javaUnable to run .jar file using .desktop file, even though it runs from terminalWhen running commands with && how can I keep it running when one command fails?Why can't java find my fonts?firejail problem with private-etcjava: error while loading shared libraries: libjli.so cannot open shared object file: no such file or directoryHow can I get `apt-get update` to reflect error status in its exit code?Running Opendaylight from Ubuntu













0















I have this command:



echo $(bash main.sh)


In main.sh, I run a java program that simply throws an exception immediately. The exit code of echo is 0 which means the command succeeded. Is there anyway to make it fail with the exit code from bash main.sh?









share







New contributor




Minh Thai is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    I have this command:



    echo $(bash main.sh)


    In main.sh, I run a java program that simply throws an exception immediately. The exit code of echo is 0 which means the command succeeded. Is there anyway to make it fail with the exit code from bash main.sh?









    share







    New contributor




    Minh Thai is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      I have this command:



      echo $(bash main.sh)


      In main.sh, I run a java program that simply throws an exception immediately. The exit code of echo is 0 which means the command succeeded. Is there anyway to make it fail with the exit code from bash main.sh?









      share







      New contributor




      Minh Thai is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I have this command:



      echo $(bash main.sh)


      In main.sh, I run a java program that simply throws an exception immediately. The exit code of echo is 0 which means the command succeeded. Is there anyway to make it fail with the exit code from bash main.sh?







      java error-handling





      share







      New contributor




      Minh Thai is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      Minh Thai is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      Minh Thai is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 1 min ago









      Minh ThaiMinh Thai

      1




      1




      New contributor




      Minh Thai is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Minh Thai is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Minh Thai is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          Minh Thai is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1121614%2fexit-with-error-from-subshell%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          Minh Thai is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Minh Thai is a new contributor. Be nice, and check out our Code of Conduct.













          Minh Thai is a new contributor. Be nice, and check out our Code of Conduct.












          Minh Thai is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1121614%2fexit-with-error-from-subshell%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

          Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

          Should I use Docker or LXD?How to cache (more) data on SSD/RAM to avoid spin up?Unable to get Windows File...