Knowledgebase

Understanding Exit Codes and Error Messages Print

  • 0

Reading what commands tell you.

WHAT AN EXIT CODE IS

A number a command returns on finishing.

WHAT ZERO MEANS

Success.

WHAT ANYTHING ELSE MEANS

Failure, with the number sometimes indicating the kind.

HOW TO SEE THE LAST ONE

Print the special variable holding it.

WHY IT MATTERS IN SCRIPTS

It is how one step knows whether the previous worked.

WHAT COMMON MESSAGES MEAN

  • Command not found: it is not installed, or not on the path
  • Permission denied: the file permissions or ownership forbid it
  • No such file or directory: the path is wrong, or a component is missing
  • Is a directory: you gave a directory where a file was expected
  • Argument list too long: a wildcard expanded to too many items

WHAT TO DO ABOUT THE LAST ONE

Use find with the execute option, or xargs.

WHAT A PERMISSION DENIED ON A PATH THAT LOOKS CORRECT USUALLY MEANS

A directory above it lacks execute permission.

WHY THAT CATCHES PEOPLE

The message names the file, not the directory at fault.

WHAT TO DO WITH AN UNFAMILIAR MESSAGE

Read it completely, then search the exact wording.

WHAT NOT TO DO

Assume it means what you expect.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot