keecode logokeecode
127

Command Not Found

Command not found

Bash

Exit Code Information

Exit Code

127

Name

Command Not Found

Category

Bash

Usage Context

Possible problem with $PATH or typo in command

Common Usage

Bash Script

#!/bin/bash

if [ condition ]; then
  echo "Command Not Found"
  exit 127
fi

Check Exit Code

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

# Check if exit code matches
if [ $? -eq 127 ]; then
  echo "Command Not Found"
fi

Node.js/JavaScript

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

// Or throw error that results in exit code
if (error) {
  console.error('Command Not Found');
  process.exit(127);
}

Python

import sys

# Exit with code 127
if error:
    print("Command Not Found")
    sys.exit(127)