Why is the exit code 255 instead of -1 in Perl?

后端 未结 3 1310
礼貌的吻别
礼貌的吻别 2020-12-03 22:21

Why is it that when I shift the exit code, $?, in Perl by eight, I get 255 when I expect it to be -1?

3条回答
  •  一向
    一向 (楼主)
    2020-12-03 23:12

    Which way are you shifting it? Please provide a code example.

    also:

    perldoc -f system
    

    gives a very easy to understand example of what to do with $?

    Also, http://www.gnu.org/s/libc/manual/html_node/Exit-Status.html

    Exit values should be between 0 and 255. Your shifting combined with how negative values are actually stored by the computer should give some insight.

提交回复
热议问题