keecode logokeecode
0

Success

Successful execution

Standard

Exit Code Information

Exit Code

0

Name

Success

Category

Standard

Usage Context

Command completed successfully without errors

Common Usage

Bash Script

#!/bin/bash

if [ condition ]; then
  echo "Success"
  exit 0
fi

Check Exit Code

./script.sh
echo $?  # Prints the exit code

# Check if exit code matches
if [ $? -eq 0 ]; then
  echo "Success"
fi

Node.js/JavaScript

// Exit with code 0
process.exit(0);

// Or throw error that results in exit code
if (error) {
  console.error('Success');
  process.exit(0);
}

Python

import sys

# Exit with code 0
if error:
    print("Success")
    sys.exit(0)