Capture exit code of exit command











up vote
6
down vote

favorite
2












I have this in a bash script:



exit 3;

exit_code="$?"

if [[ "$exit_code" != "0" ]]; then
echo -e "${r2g_magenta}Your r2g process is exiting with code $exit_code.${r2g_no_color}";
exit "$exit_code";
fi


It looks like it will exit right after the exit command, which makes sense.
I was wondering is there some simple command that can provide an exit code without exiting right away?



I was going to guess:



exec exit 3


but it gives an error message: exec: exit: not found
What can I do? :)










share|improve this question









New contributor




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
















  • 1




    Yeah exec exit 3 is no bueno, I get "exec: exit: not found"
    – MrCholo
    17 hours ago










  • I don't understand the question. Why not set exit_code=3 and eliminate the exit 3 line altogether?
    – wjandrea
    7 hours ago










  • @wjandrea is more a conceptual question than practical
    – MrCholo
    1 hour ago















up vote
6
down vote

favorite
2












I have this in a bash script:



exit 3;

exit_code="$?"

if [[ "$exit_code" != "0" ]]; then
echo -e "${r2g_magenta}Your r2g process is exiting with code $exit_code.${r2g_no_color}";
exit "$exit_code";
fi


It looks like it will exit right after the exit command, which makes sense.
I was wondering is there some simple command that can provide an exit code without exiting right away?



I was going to guess:



exec exit 3


but it gives an error message: exec: exit: not found
What can I do? :)










share|improve this question









New contributor




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
















  • 1




    Yeah exec exit 3 is no bueno, I get "exec: exit: not found"
    – MrCholo
    17 hours ago










  • I don't understand the question. Why not set exit_code=3 and eliminate the exit 3 line altogether?
    – wjandrea
    7 hours ago










  • @wjandrea is more a conceptual question than practical
    – MrCholo
    1 hour ago













up vote
6
down vote

favorite
2









up vote
6
down vote

favorite
2






2





I have this in a bash script:



exit 3;

exit_code="$?"

if [[ "$exit_code" != "0" ]]; then
echo -e "${r2g_magenta}Your r2g process is exiting with code $exit_code.${r2g_no_color}";
exit "$exit_code";
fi


It looks like it will exit right after the exit command, which makes sense.
I was wondering is there some simple command that can provide an exit code without exiting right away?



I was going to guess:



exec exit 3


but it gives an error message: exec: exit: not found
What can I do? :)










share|improve this question









New contributor




MrCholo 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 in a bash script:



exit 3;

exit_code="$?"

if [[ "$exit_code" != "0" ]]; then
echo -e "${r2g_magenta}Your r2g process is exiting with code $exit_code.${r2g_no_color}";
exit "$exit_code";
fi


It looks like it will exit right after the exit command, which makes sense.
I was wondering is there some simple command that can provide an exit code without exiting right away?



I was going to guess:



exec exit 3


but it gives an error message: exec: exit: not found
What can I do? :)







bash shell-script exec exit exit-code






share|improve this question









New contributor




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











share|improve this question









New contributor




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









share|improve this question




share|improve this question








edited 6 hours ago









G-Man

12.6k93064




12.6k93064






New contributor




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









asked 17 hours ago









MrCholo

1364




1364




New contributor




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





New contributor





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






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








  • 1




    Yeah exec exit 3 is no bueno, I get "exec: exit: not found"
    – MrCholo
    17 hours ago










  • I don't understand the question. Why not set exit_code=3 and eliminate the exit 3 line altogether?
    – wjandrea
    7 hours ago










  • @wjandrea is more a conceptual question than practical
    – MrCholo
    1 hour ago














  • 1




    Yeah exec exit 3 is no bueno, I get "exec: exit: not found"
    – MrCholo
    17 hours ago










  • I don't understand the question. Why not set exit_code=3 and eliminate the exit 3 line altogether?
    – wjandrea
    7 hours ago










  • @wjandrea is more a conceptual question than practical
    – MrCholo
    1 hour ago








1




1




Yeah exec exit 3 is no bueno, I get "exec: exit: not found"
– MrCholo
17 hours ago




Yeah exec exit 3 is no bueno, I get "exec: exit: not found"
– MrCholo
17 hours ago












I don't understand the question. Why not set exit_code=3 and eliminate the exit 3 line altogether?
– wjandrea
7 hours ago




I don't understand the question. Why not set exit_code=3 and eliminate the exit 3 line altogether?
– wjandrea
7 hours ago












@wjandrea is more a conceptual question than practical
– MrCholo
1 hour ago




@wjandrea is more a conceptual question than practical
– MrCholo
1 hour ago










5 Answers
5






active

oldest

votes

















up vote
19
down vote



accepted










If you have a script that runs some program
and looks at the program's exit status (with $?),
and you want to test that script by doing something
that causes $? to be set to some known value (e.g., 3), just do



(exit 3)


The parentheses create a sub-shell. 
Then the exit command causes that sub-shell
to exit with the specified exit status.






share|improve this answer




























    up vote
    8
    down vote













    exit is a bash built-in, so you can't exec it. Per bash's manual:




    Bash's exit status is the exit status of the last command executed in the script. If no commands are executed, the exit status is 0.




    Putting all this together, I'd say your only option is to store your desired exit status in a variable and then exit $MY_EXIT_STATUS when appropriate.






    share|improve this answer








    New contributor




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


















    • hmmm what do you think about @G-man's idea?
      – MrCholo
      17 hours ago






    • 1




      Maybe I misunderstood what you're trying to accomplish. If you're just trying to set $? (though I'm not really sure why you would), that does seem like a solid answer. If you just want to set it to some unsuccessful value, false is another option.
      – solarshado
      17 hours ago


















    up vote
    5
    down vote













    You can write a function that returns the status given as argument, or 255 if none given. (I call it ret as it "returns" its value.)



    ret() { return "${1:-255}"; }


    and use ret in place of your call to exit. This is avoids the inefficiency of creating the sub-shell in the currently accepted answer.






    share|improve this answer



















    • 2




      @iBug The extra space is not needed.
      – icarus
      12 hours ago










    • Good point about the inefficiency of creating the sub-shell.  I've read that some shells might be smart enough to optimize the fork out in cases like this, but that bash isn't one of them.
      – G-Man
      6 hours ago


















    up vote
    3
    down vote













    About exec exit 3... it would try to run an external command called exit, but there isn't one, so you get the error. It has to be an external command instead of one built in to the shell, since exec replaces the shell completely. Which also means that even if you had an external command called exit, exec exit 3 would not return to continue your shell script, since the shell wouldn't be there any more.






    share|improve this answer





















    • I guess you could do exec bash -c "exit 3", but at the moment I can't think of any reason to do that as opposed to just exit 3.
      – David Z
      10 hours ago










    • @DavidZ, in any case, exec'ing or just exit'ing will stop the script, which didn't seem like what the question wanted.
      – ilkkachu
      8 hours ago


















    up vote
    2
    down vote













    You can do this with Awk:



    awk 'BEGIN{exit 9}'


    Or Sed:



    sed Q9 /proc/stat





    share|improve this answer





















    • ...or with a shell: sh -c 'exit 9'
      – ilkkachu
      8 hours ago










    • @ilkkachu if youre going to do that you might as well do the (exit 9) in the accepted answer
      – Steven Penny
      7 hours 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',
    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
    });


    }
    });






    MrCholo 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%2funix.stackexchange.com%2fquestions%2f486902%2fcapture-exit-code-of-exit-command%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    5 Answers
    5






    active

    oldest

    votes








    5 Answers
    5






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    19
    down vote



    accepted










    If you have a script that runs some program
    and looks at the program's exit status (with $?),
    and you want to test that script by doing something
    that causes $? to be set to some known value (e.g., 3), just do



    (exit 3)


    The parentheses create a sub-shell. 
    Then the exit command causes that sub-shell
    to exit with the specified exit status.






    share|improve this answer

























      up vote
      19
      down vote



      accepted










      If you have a script that runs some program
      and looks at the program's exit status (with $?),
      and you want to test that script by doing something
      that causes $? to be set to some known value (e.g., 3), just do



      (exit 3)


      The parentheses create a sub-shell. 
      Then the exit command causes that sub-shell
      to exit with the specified exit status.






      share|improve this answer























        up vote
        19
        down vote



        accepted







        up vote
        19
        down vote



        accepted






        If you have a script that runs some program
        and looks at the program's exit status (with $?),
        and you want to test that script by doing something
        that causes $? to be set to some known value (e.g., 3), just do



        (exit 3)


        The parentheses create a sub-shell. 
        Then the exit command causes that sub-shell
        to exit with the specified exit status.






        share|improve this answer












        If you have a script that runs some program
        and looks at the program's exit status (with $?),
        and you want to test that script by doing something
        that causes $? to be set to some known value (e.g., 3), just do



        (exit 3)


        The parentheses create a sub-shell. 
        Then the exit command causes that sub-shell
        to exit with the specified exit status.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 17 hours ago









        G-Man

        12.6k93064




        12.6k93064
























            up vote
            8
            down vote













            exit is a bash built-in, so you can't exec it. Per bash's manual:




            Bash's exit status is the exit status of the last command executed in the script. If no commands are executed, the exit status is 0.




            Putting all this together, I'd say your only option is to store your desired exit status in a variable and then exit $MY_EXIT_STATUS when appropriate.






            share|improve this answer








            New contributor




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


















            • hmmm what do you think about @G-man's idea?
              – MrCholo
              17 hours ago






            • 1




              Maybe I misunderstood what you're trying to accomplish. If you're just trying to set $? (though I'm not really sure why you would), that does seem like a solid answer. If you just want to set it to some unsuccessful value, false is another option.
              – solarshado
              17 hours ago















            up vote
            8
            down vote













            exit is a bash built-in, so you can't exec it. Per bash's manual:




            Bash's exit status is the exit status of the last command executed in the script. If no commands are executed, the exit status is 0.




            Putting all this together, I'd say your only option is to store your desired exit status in a variable and then exit $MY_EXIT_STATUS when appropriate.






            share|improve this answer








            New contributor




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


















            • hmmm what do you think about @G-man's idea?
              – MrCholo
              17 hours ago






            • 1




              Maybe I misunderstood what you're trying to accomplish. If you're just trying to set $? (though I'm not really sure why you would), that does seem like a solid answer. If you just want to set it to some unsuccessful value, false is another option.
              – solarshado
              17 hours ago













            up vote
            8
            down vote










            up vote
            8
            down vote









            exit is a bash built-in, so you can't exec it. Per bash's manual:




            Bash's exit status is the exit status of the last command executed in the script. If no commands are executed, the exit status is 0.




            Putting all this together, I'd say your only option is to store your desired exit status in a variable and then exit $MY_EXIT_STATUS when appropriate.






            share|improve this answer








            New contributor




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









            exit is a bash built-in, so you can't exec it. Per bash's manual:




            Bash's exit status is the exit status of the last command executed in the script. If no commands are executed, the exit status is 0.




            Putting all this together, I'd say your only option is to store your desired exit status in a variable and then exit $MY_EXIT_STATUS when appropriate.







            share|improve this answer








            New contributor




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









            share|improve this answer



            share|improve this answer






            New contributor




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









            answered 17 hours ago









            solarshado

            20913




            20913




            New contributor




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





            New contributor





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






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












            • hmmm what do you think about @G-man's idea?
              – MrCholo
              17 hours ago






            • 1




              Maybe I misunderstood what you're trying to accomplish. If you're just trying to set $? (though I'm not really sure why you would), that does seem like a solid answer. If you just want to set it to some unsuccessful value, false is another option.
              – solarshado
              17 hours ago


















            • hmmm what do you think about @G-man's idea?
              – MrCholo
              17 hours ago






            • 1




              Maybe I misunderstood what you're trying to accomplish. If you're just trying to set $? (though I'm not really sure why you would), that does seem like a solid answer. If you just want to set it to some unsuccessful value, false is another option.
              – solarshado
              17 hours ago
















            hmmm what do you think about @G-man's idea?
            – MrCholo
            17 hours ago




            hmmm what do you think about @G-man's idea?
            – MrCholo
            17 hours ago




            1




            1




            Maybe I misunderstood what you're trying to accomplish. If you're just trying to set $? (though I'm not really sure why you would), that does seem like a solid answer. If you just want to set it to some unsuccessful value, false is another option.
            – solarshado
            17 hours ago




            Maybe I misunderstood what you're trying to accomplish. If you're just trying to set $? (though I'm not really sure why you would), that does seem like a solid answer. If you just want to set it to some unsuccessful value, false is another option.
            – solarshado
            17 hours ago










            up vote
            5
            down vote













            You can write a function that returns the status given as argument, or 255 if none given. (I call it ret as it "returns" its value.)



            ret() { return "${1:-255}"; }


            and use ret in place of your call to exit. This is avoids the inefficiency of creating the sub-shell in the currently accepted answer.






            share|improve this answer



















            • 2




              @iBug The extra space is not needed.
              – icarus
              12 hours ago










            • Good point about the inefficiency of creating the sub-shell.  I've read that some shells might be smart enough to optimize the fork out in cases like this, but that bash isn't one of them.
              – G-Man
              6 hours ago















            up vote
            5
            down vote













            You can write a function that returns the status given as argument, or 255 if none given. (I call it ret as it "returns" its value.)



            ret() { return "${1:-255}"; }


            and use ret in place of your call to exit. This is avoids the inefficiency of creating the sub-shell in the currently accepted answer.






            share|improve this answer



















            • 2




              @iBug The extra space is not needed.
              – icarus
              12 hours ago










            • Good point about the inefficiency of creating the sub-shell.  I've read that some shells might be smart enough to optimize the fork out in cases like this, but that bash isn't one of them.
              – G-Man
              6 hours ago













            up vote
            5
            down vote










            up vote
            5
            down vote









            You can write a function that returns the status given as argument, or 255 if none given. (I call it ret as it "returns" its value.)



            ret() { return "${1:-255}"; }


            and use ret in place of your call to exit. This is avoids the inefficiency of creating the sub-shell in the currently accepted answer.






            share|improve this answer














            You can write a function that returns the status given as argument, or 255 if none given. (I call it ret as it "returns" its value.)



            ret() { return "${1:-255}"; }


            and use ret in place of your call to exit. This is avoids the inefficiency of creating the sub-shell in the currently accepted answer.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 8 hours ago









            ilkkachu

            54.3k782147




            54.3k782147










            answered 13 hours ago









            icarus

            5,0311825




            5,0311825








            • 2




              @iBug The extra space is not needed.
              – icarus
              12 hours ago










            • Good point about the inefficiency of creating the sub-shell.  I've read that some shells might be smart enough to optimize the fork out in cases like this, but that bash isn't one of them.
              – G-Man
              6 hours ago














            • 2




              @iBug The extra space is not needed.
              – icarus
              12 hours ago










            • Good point about the inefficiency of creating the sub-shell.  I've read that some shells might be smart enough to optimize the fork out in cases like this, but that bash isn't one of them.
              – G-Man
              6 hours ago








            2




            2




            @iBug The extra space is not needed.
            – icarus
            12 hours ago




            @iBug The extra space is not needed.
            – icarus
            12 hours ago












            Good point about the inefficiency of creating the sub-shell.  I've read that some shells might be smart enough to optimize the fork out in cases like this, but that bash isn't one of them.
            – G-Man
            6 hours ago




            Good point about the inefficiency of creating the sub-shell.  I've read that some shells might be smart enough to optimize the fork out in cases like this, but that bash isn't one of them.
            – G-Man
            6 hours ago










            up vote
            3
            down vote













            About exec exit 3... it would try to run an external command called exit, but there isn't one, so you get the error. It has to be an external command instead of one built in to the shell, since exec replaces the shell completely. Which also means that even if you had an external command called exit, exec exit 3 would not return to continue your shell script, since the shell wouldn't be there any more.






            share|improve this answer





















            • I guess you could do exec bash -c "exit 3", but at the moment I can't think of any reason to do that as opposed to just exit 3.
              – David Z
              10 hours ago










            • @DavidZ, in any case, exec'ing or just exit'ing will stop the script, which didn't seem like what the question wanted.
              – ilkkachu
              8 hours ago















            up vote
            3
            down vote













            About exec exit 3... it would try to run an external command called exit, but there isn't one, so you get the error. It has to be an external command instead of one built in to the shell, since exec replaces the shell completely. Which also means that even if you had an external command called exit, exec exit 3 would not return to continue your shell script, since the shell wouldn't be there any more.






            share|improve this answer





















            • I guess you could do exec bash -c "exit 3", but at the moment I can't think of any reason to do that as opposed to just exit 3.
              – David Z
              10 hours ago










            • @DavidZ, in any case, exec'ing or just exit'ing will stop the script, which didn't seem like what the question wanted.
              – ilkkachu
              8 hours ago













            up vote
            3
            down vote










            up vote
            3
            down vote









            About exec exit 3... it would try to run an external command called exit, but there isn't one, so you get the error. It has to be an external command instead of one built in to the shell, since exec replaces the shell completely. Which also means that even if you had an external command called exit, exec exit 3 would not return to continue your shell script, since the shell wouldn't be there any more.






            share|improve this answer












            About exec exit 3... it would try to run an external command called exit, but there isn't one, so you get the error. It has to be an external command instead of one built in to the shell, since exec replaces the shell completely. Which also means that even if you had an external command called exit, exec exit 3 would not return to continue your shell script, since the shell wouldn't be there any more.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 15 hours ago









            ilkkachu

            54.3k782147




            54.3k782147












            • I guess you could do exec bash -c "exit 3", but at the moment I can't think of any reason to do that as opposed to just exit 3.
              – David Z
              10 hours ago










            • @DavidZ, in any case, exec'ing or just exit'ing will stop the script, which didn't seem like what the question wanted.
              – ilkkachu
              8 hours ago


















            • I guess you could do exec bash -c "exit 3", but at the moment I can't think of any reason to do that as opposed to just exit 3.
              – David Z
              10 hours ago










            • @DavidZ, in any case, exec'ing or just exit'ing will stop the script, which didn't seem like what the question wanted.
              – ilkkachu
              8 hours ago
















            I guess you could do exec bash -c "exit 3", but at the moment I can't think of any reason to do that as opposed to just exit 3.
            – David Z
            10 hours ago




            I guess you could do exec bash -c "exit 3", but at the moment I can't think of any reason to do that as opposed to just exit 3.
            – David Z
            10 hours ago












            @DavidZ, in any case, exec'ing or just exit'ing will stop the script, which didn't seem like what the question wanted.
            – ilkkachu
            8 hours ago




            @DavidZ, in any case, exec'ing or just exit'ing will stop the script, which didn't seem like what the question wanted.
            – ilkkachu
            8 hours ago










            up vote
            2
            down vote













            You can do this with Awk:



            awk 'BEGIN{exit 9}'


            Or Sed:



            sed Q9 /proc/stat





            share|improve this answer





















            • ...or with a shell: sh -c 'exit 9'
              – ilkkachu
              8 hours ago










            • @ilkkachu if youre going to do that you might as well do the (exit 9) in the accepted answer
              – Steven Penny
              7 hours ago















            up vote
            2
            down vote













            You can do this with Awk:



            awk 'BEGIN{exit 9}'


            Or Sed:



            sed Q9 /proc/stat





            share|improve this answer





















            • ...or with a shell: sh -c 'exit 9'
              – ilkkachu
              8 hours ago










            • @ilkkachu if youre going to do that you might as well do the (exit 9) in the accepted answer
              – Steven Penny
              7 hours ago













            up vote
            2
            down vote










            up vote
            2
            down vote









            You can do this with Awk:



            awk 'BEGIN{exit 9}'


            Or Sed:



            sed Q9 /proc/stat





            share|improve this answer












            You can do this with Awk:



            awk 'BEGIN{exit 9}'


            Or Sed:



            sed Q9 /proc/stat






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 9 hours ago









            Steven Penny

            2,51021738




            2,51021738












            • ...or with a shell: sh -c 'exit 9'
              – ilkkachu
              8 hours ago










            • @ilkkachu if youre going to do that you might as well do the (exit 9) in the accepted answer
              – Steven Penny
              7 hours ago


















            • ...or with a shell: sh -c 'exit 9'
              – ilkkachu
              8 hours ago










            • @ilkkachu if youre going to do that you might as well do the (exit 9) in the accepted answer
              – Steven Penny
              7 hours ago
















            ...or with a shell: sh -c 'exit 9'
            – ilkkachu
            8 hours ago




            ...or with a shell: sh -c 'exit 9'
            – ilkkachu
            8 hours ago












            @ilkkachu if youre going to do that you might as well do the (exit 9) in the accepted answer
            – Steven Penny
            7 hours ago




            @ilkkachu if youre going to do that you might as well do the (exit 9) in the accepted answer
            – Steven Penny
            7 hours ago










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










            draft saved

            draft discarded


















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













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












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
















            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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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%2f486902%2fcapture-exit-code-of-exit-command%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

            Mont Emei

            Province de Neuquén

            Journaliste