keecode logokeecode
2

Misuse

Misuse of shell builtins

Standard

Exit Code Information

Exit Code

2

Name

Misuse

Category

Standard

Usage Context

Missing keyword or command, or permission problem

Common Usage

Bash Script

#!/bin/bash

if [ condition ]; then
  echo "Misuse"
  exit 2
fi

Check Exit Code

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

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

Node.js/JavaScript

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

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

Python

import sys

# Exit with code 2
if error:
    print("Misuse")
    sys.exit(2)