There is no difference. When exit
called without a parameter, it returns the exit code of the last command.
GNU bash. , last_command_exit_value
, , , , 8 .
486 get_exitstat (list)
487 WORD_LIST *list;
488 {
489 int status;
490 intmax_t sval;
491 char *arg;
492
493 if (list && list->word && ISOPTION (list->word->word, '-'))
494 list = list->next;
495
496 if (list == 0)
497 return (last_command_exit_value);
498
499 arg = list->word->word;
500 if (arg == 0 || legal_number (arg, &sval) == 0)
501 {
502 sh_neednumarg (list->word->word ? list->word->word : "`'");
503 return EX_BADUSAGE;
504 }
505 no_args (list->next);
506
507 status = sval & 255;
508 return status;
509 }