11

Which do we want to keep and which should be synonymed to the other?

, with 118 questions, says:

Use this tag If your question revolves around determining or utilizing the return status (exit code) of a command. Common syntax involves the $? variable and the && and || symbols.

, with 31 questions, says:

The exit-code tag has no usage guidance, can you help us create it?


Additional data (as of 2019-02-17):


Wikipedia has "exit status" with redirections from "exit code" and "result code"; there is also "return code" aka "error code".


The bash manual and the zsh manual both use the term "exit status".


As mentioned, the POSIX standard uses the term "exit status".


Let's go ahead and rule out %ERRORLEVEL% :)

  • 1
    Unfortunately, the POSIX standard uses the term "exit status", which kinda straddles both. In any case, I like "status" better than "code" as a code implies a specific meaning (other than success or failure), as in "errno". – Kusalananda Feb 16 at 10:05
  • Actually, the "new" way of waiting for processes, which "only" dates back to the mid-1980s, has a siginfo_t with both "code" and "status", separately. – JdeBP Feb 16 at 10:32
  • 1
    The man pages for bash and ksh both refer to exit status. – Stephen Harris Feb 17 at 1:27
  • Wow; looks like we may need several synonyms! – Jeff Schaller Feb 17 at 1:36
18

After seeing the additional data, I'm leaning towards this idea:


I've created the tag and populated it with the excerpt and wiki (slightly modified to say "exit status" instead of "return status").

I believe the next steps are:

  1. merge into and make a synonym for .
  2. merge into and make a synonym for .
  3. create as a synonym of

Helpful link: Moderator cheat sheet for tags

  • 2
    This is good. I think this is the best solution. I wonder, though, if it's worth having return-code as its own tag, as it could be applied in other circumstances, possibly. Hmm... probably not. – Kusalananda Feb 18 at 9:05
  • Agree with this one. I'll chip in another term: return-value – Sergiy Kolodyazhnyy Feb 18 at 23:51
  • 2
    @SergiyKolodyazhnyy I don't think return-value would be as useful as it would be on the StackOverflow site as it is a term mainly used in non-shell languages. In the shell, the return statement returns the exit status of the most recently executed command from a function or dot script (or an explicit exit status). – Kusalananda Feb 19 at 10:13
  • @Kusalananda I'm well aware of how it's used within shell context. I'm just suggesting that as possible synonym, which may be used by those more used to programming terminology. Like I already said, I sufficiently agree with Jeff's answer – Sergiy Kolodyazhnyy Feb 19 at 10:37
  • 3
    @SergiyKolodyazhnyy Contrary to my opinion about exit-code, I think return-value would be misplaced. While the code/status returned is, by definition, a "value", it is not what most people, programmer or not, consider a return value in practice. The implication is that the called function/command "returns" a value, as in a=myFunc(42) executes myFunc and places some value into a. a=$( myFunc 42 ) gives a return value and an exit code. – Gypsy Spellweaver Feb 20 at 3:21
  • A return value is for functions; while an exit status (or exit code) is for processes. The key word in this distinction is return (as distinct from edit). – DopeGhoti Feb 26 at 15:44
  • 1
    It might be worth changing the question tag from discussion to feature-request to request a moderator to implement this suggestion. 14-0 seems quite close to consensus to me. – Anthony G - justice for Monica Feb 26 at 18:34
  • 1
    @AnthonyGeoghegan I wasn't sure what the official process was, so I went ahead and bothered terdon in chat; I will work with him tomorrow morning. In the meantime, I've updated the Answer with what I think the next steps are. If anyone sees this in the meantime, please correct me if I'm heading the wrong way! – Jeff Schaller Feb 28 at 1:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .