What this page is for

bad interpreter is for a shell script fails because the shebang points to a path Termux does not have. Stay on this page if the error matches the title and the command output points to the same layer for bad interpreter.

Work on bad interpreter only after you can point to the exact clue in the terminal or browser output. For this guide, the main clues are bad, interpreter, bash, bin, and the page description is: Fix bad interpreter, /bin/bash not found, CRLF line endings, wrong shebangs, and copied shell scripts that fail on Android Termux.

Signs you are on the right page

Why it happens in Termux

bad interpreter belongs to the phone workflow layer. In Termux, that layer can change because Android paths, package state, working folders, cached browser files, or Git settings are not shared the way they are on a desktop Linux system for bad interpreter.

Copyable command

Run this from the folder that belongs to bad interpreter. Replace placeholder names before pressing Enter.

head -n 1 script.sh
sed -i "s|^#!/bin/bash|#!/usr/bin/env bash|" script.sh
pkg install dos2unix -y
dos2unix script.sh
chmod +x script.sh
./script.sh

How to read the output

  1. head -n 1 script.sh — Runs a focused check for bad interpreter; compare its output with the symptom before changing anything else.
  2. sed -i "s|^#!/bin/bash|#!/usr/bin/env bash|" script.sh — Runs a focused check for bad interpreter; compare its output with the symptom before changing anything else.
  3. pkg install dos2unix -y — Installs the Termux package named in the command; read the package name before pressing Enter.
  4. dos2unix script.sh — Runs a focused check for bad interpreter; compare its output with the symptom before changing anything else.
  5. chmod +x script.sh — Changes execute permission for scripts that must run directly for bad interpreter.
  6. ./script.sh — Runs a focused check for bad interpreter; compare its output with the symptom before changing anything else.

Fix it in this order

  1. Copy the exact bad interpreter message before changing anything. Keep the command, folder, and first useful error line together.
  2. Run only the diagnostic part of the command block. If it fails early, do not continue to the later lines yet.
  3. Fix the layer named by the first useful output line: path, permission, package, Python environment, Git state, or browser URL for bad interpreter.
  4. Retest with the shortest command that originally failed. Do not restart the whole project until the small test works.
  5. When it works, write down the final command in your notes or README so the same bad interpreter problem is easier next time.

Common mistakes

Before you leave the page

Guide did not solve it?

If you want this organized for a real DedSec-style workflow, use the Store and send the folder tree, goal, and the part that keeps breaking for bad interpreter. Mention that the page you tried was: bad interpreter.

Open Store / Get Help

Related Assistance pages