keecode logokeecode
128

Invalid Exit Argument

Invalid argument to exit

Bash

Exit Code Information

Exit Code

128

Name

Invalid Exit Argument

Category

Bash

Usage Context

exit takes only integer args in the range 0-255

Common Usage

Bash Script

#!/bin/bash

if [ condition ]; then
  echo "Invalid Exit Argument"
  exit 128
fi

Check Exit Code

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

# Check if exit code matches
if [ $? -eq 128 ]; then
  echo "Invalid Exit Argument"
fi

Node.js/JavaScript

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

// Or throw error that results in exit code
if (error) {
  console.error('Invalid Exit Argument');
  process.exit(128);
}

Python

import sys

# Exit with code 128
if error:
    print("Invalid Exit Argument")
    sys.exit(128)