Why doesn't back-slash yield non-zero exit codemake `find` return with a non-zero exit code if error...

An average heaven where everyone has sexless golden bodies and is bored

Passing multiple files through stdin (over ssh)

What risks are there when you clear your cookies instead of logging off?

Why doesn’t a normal window produce an apparent rainbow?

What language is the software written in on the ISS?

Trapping Rain Water

Where does "0 packages can be updated." come from?

Understanding the TeXlive release cycle: What is the meaning of a TeXlive release and is it ever 'finished'?

What could have caused a rear derailleur to end up in the back wheel suddenly?

How do governments keep track of their issued currency?

What are the peak hours for public transportation in Paris?

When conversion from Integer to Single may lose precision

Do simulator games use a realistic trajectory to get into orbit?

Can a black dragonborn's acid breath weapon destroy objects?

How to chain Python function calls so the behaviour is as follows

Can a user sell my software (MIT license) without modification?

What is wrong with this proof that symmetric matrices commute?

Should I compare a std::string to "string" or "string"s?

How to retract an idea already pitched to an employer?

Is using haveibeenpwned to validate password strength rational?

Russian equivalents of "no love lost"

Implement Homestuck's Catenative Doomsday Dice Cascader

At what point in time did Dumbledore ask Snape for this favor?

What's up with this leaf?



Why doesn't back-slash yield non-zero exit code


make `find` return with a non-zero exit code if error occuredSave exit code for laterbreaking out of command loop but exit code not the reason?Exit code at the end of a bash scriptCan't determine why exit code is not being loggedTrigger a non-zero exit code when I break out of a loopSubshell exit code affects loggingWell Behaved Non-Zero Exit Codes?Bash error => “exit: code: numeric argument required”What exit code integer grep returns when it doesn't match a string?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







-2















If run:



 true  false; echo $?


I get an exit code of 0. Does anyone know why that is?










share|improve this question





























    -2















    If run:



     true  false; echo $?


    I get an exit code of 0. Does anyone know why that is?










    share|improve this question

























      -2












      -2








      -2


      0






      If run:



       true  false; echo $?


      I get an exit code of 0. Does anyone know why that is?










      share|improve this question














      If run:



       true  false; echo $?


      I get an exit code of 0. Does anyone know why that is?







      bash shell exit-status






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 1 hour ago









      Alexander MillsAlexander Mills

      2,42221963




      2,42221963






















          2 Answers
          2






          active

          oldest

          votes


















          4














          true  false


          is equivalent to



          true ' false'


          It causes the shell to run true with false (including an initial space character) as its parameter. The implementation of true that you’re using ignores this parameter and exits with a zero return value.






          share|improve this answer


























          • oh duh lol thanks

            – Alexander Mills
            58 mins ago











          • Note that the behaviour of true when given any argument is unspecified by POSIX, some implementations may very well return a syntax error and a non-zero exit status.

            – Stéphane Chazelas
            46 mins ago











          • Backticks won't preserve the leading space. You'll have to use <code> false</code> for that.

            – muru
            42 mins ago













          • @muru <code> doesn’t either, at least not for me...

            – Stephen Kitt
            41 mins ago











          • @StephenKitt hmmm, works for me: meta.stackexchange.com/a/329041/270345 Ah, well.

            – muru
            38 mins ago



















          3














          You're just running the command true with some arguments. Since those arguments aren't options, it doesn't matter what they are.






          share|improve this answer
























          • oh duh lol thanks

            – Alexander Mills
            58 mins ago












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          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: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          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
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f522746%2fwhy-doesnt-back-slash-yield-non-zero-exit-code%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4














          true  false


          is equivalent to



          true ' false'


          It causes the shell to run true with false (including an initial space character) as its parameter. The implementation of true that you’re using ignores this parameter and exits with a zero return value.






          share|improve this answer


























          • oh duh lol thanks

            – Alexander Mills
            58 mins ago











          • Note that the behaviour of true when given any argument is unspecified by POSIX, some implementations may very well return a syntax error and a non-zero exit status.

            – Stéphane Chazelas
            46 mins ago











          • Backticks won't preserve the leading space. You'll have to use <code> false</code> for that.

            – muru
            42 mins ago













          • @muru <code> doesn’t either, at least not for me...

            – Stephen Kitt
            41 mins ago











          • @StephenKitt hmmm, works for me: meta.stackexchange.com/a/329041/270345 Ah, well.

            – muru
            38 mins ago
















          4














          true  false


          is equivalent to



          true ' false'


          It causes the shell to run true with false (including an initial space character) as its parameter. The implementation of true that you’re using ignores this parameter and exits with a zero return value.






          share|improve this answer


























          • oh duh lol thanks

            – Alexander Mills
            58 mins ago











          • Note that the behaviour of true when given any argument is unspecified by POSIX, some implementations may very well return a syntax error and a non-zero exit status.

            – Stéphane Chazelas
            46 mins ago











          • Backticks won't preserve the leading space. You'll have to use <code> false</code> for that.

            – muru
            42 mins ago













          • @muru <code> doesn’t either, at least not for me...

            – Stephen Kitt
            41 mins ago











          • @StephenKitt hmmm, works for me: meta.stackexchange.com/a/329041/270345 Ah, well.

            – muru
            38 mins ago














          4












          4








          4







          true  false


          is equivalent to



          true ' false'


          It causes the shell to run true with false (including an initial space character) as its parameter. The implementation of true that you’re using ignores this parameter and exits with a zero return value.






          share|improve this answer















          true  false


          is equivalent to



          true ' false'


          It causes the shell to run true with false (including an initial space character) as its parameter. The implementation of true that you’re using ignores this parameter and exits with a zero return value.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 45 mins ago

























          answered 1 hour ago









          Stephen KittStephen Kitt

          189k26442520




          189k26442520













          • oh duh lol thanks

            – Alexander Mills
            58 mins ago











          • Note that the behaviour of true when given any argument is unspecified by POSIX, some implementations may very well return a syntax error and a non-zero exit status.

            – Stéphane Chazelas
            46 mins ago











          • Backticks won't preserve the leading space. You'll have to use <code> false</code> for that.

            – muru
            42 mins ago













          • @muru <code> doesn’t either, at least not for me...

            – Stephen Kitt
            41 mins ago











          • @StephenKitt hmmm, works for me: meta.stackexchange.com/a/329041/270345 Ah, well.

            – muru
            38 mins ago



















          • oh duh lol thanks

            – Alexander Mills
            58 mins ago











          • Note that the behaviour of true when given any argument is unspecified by POSIX, some implementations may very well return a syntax error and a non-zero exit status.

            – Stéphane Chazelas
            46 mins ago











          • Backticks won't preserve the leading space. You'll have to use <code> false</code> for that.

            – muru
            42 mins ago













          • @muru <code> doesn’t either, at least not for me...

            – Stephen Kitt
            41 mins ago











          • @StephenKitt hmmm, works for me: meta.stackexchange.com/a/329041/270345 Ah, well.

            – muru
            38 mins ago

















          oh duh lol thanks

          – Alexander Mills
          58 mins ago





          oh duh lol thanks

          – Alexander Mills
          58 mins ago













          Note that the behaviour of true when given any argument is unspecified by POSIX, some implementations may very well return a syntax error and a non-zero exit status.

          – Stéphane Chazelas
          46 mins ago





          Note that the behaviour of true when given any argument is unspecified by POSIX, some implementations may very well return a syntax error and a non-zero exit status.

          – Stéphane Chazelas
          46 mins ago













          Backticks won't preserve the leading space. You'll have to use <code> false</code> for that.

          – muru
          42 mins ago







          Backticks won't preserve the leading space. You'll have to use <code> false</code> for that.

          – muru
          42 mins ago















          @muru <code> doesn’t either, at least not for me...

          – Stephen Kitt
          41 mins ago





          @muru <code> doesn’t either, at least not for me...

          – Stephen Kitt
          41 mins ago













          @StephenKitt hmmm, works for me: meta.stackexchange.com/a/329041/270345 Ah, well.

          – muru
          38 mins ago





          @StephenKitt hmmm, works for me: meta.stackexchange.com/a/329041/270345 Ah, well.

          – muru
          38 mins ago













          3














          You're just running the command true with some arguments. Since those arguments aren't options, it doesn't matter what they are.






          share|improve this answer
























          • oh duh lol thanks

            – Alexander Mills
            58 mins ago
















          3














          You're just running the command true with some arguments. Since those arguments aren't options, it doesn't matter what they are.






          share|improve this answer
























          • oh duh lol thanks

            – Alexander Mills
            58 mins ago














          3












          3








          3







          You're just running the command true with some arguments. Since those arguments aren't options, it doesn't matter what they are.






          share|improve this answer













          You're just running the command true with some arguments. Since those arguments aren't options, it doesn't matter what they are.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 1 hour ago









          murumuru

          38.7k592168




          38.7k592168













          • oh duh lol thanks

            – Alexander Mills
            58 mins ago



















          • oh duh lol thanks

            – Alexander Mills
            58 mins ago

















          oh duh lol thanks

          – Alexander Mills
          58 mins ago





          oh duh lol thanks

          – Alexander Mills
          58 mins ago


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • 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%2funix.stackexchange.com%2fquestions%2f522746%2fwhy-doesnt-back-slash-yield-non-zero-exit-code%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

          Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

          Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

          Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...