# Simon Willison — Using LLM in the Shebang Line of a Script

> Simon Willison turns a one-line English description into an executable LLM script via the Unix shebang line.

- Org: Simon Willison
- Date: 2026-05-11
- Category: article
- Source: https://simonwillison.net/2026/May/11/llm-shebang/
- Canonical page: https://ai-tldr.dev/releases/simonw-llm-shebang/

## In short

Three patterns for executable shebang scripts that route through Simon Willison's llm CLI: fragments via -f, named tools via -T, and full YAML templates that define custom Python tool functions in one file.

## What it is

A short technique post showing how to build runnable shell scripts whose body is consumed by Simon Willison's `llm` CLI tool rather than a shell. Stdin pipes through the chosen model and the script's text becomes either a prompt fragment, a tool-augmented call, or a YAML template that bundles tools and parameters. The idea was sparked by a Hacker News comment suggesting you could put a shebang on an English text file.

## How it works

Three escalating patterns. `#!/usr/bin/env -S llm -f` treats the file as a prompt fragment. Adding `-T <tool>` lets the model call named Python functions during the run. A YAML template defines model parameters, system prompts, and custom Python tool functions inline so the shebang launches a self-contained agent. The companion TIL walks through a Datasette SQL example end-to-end.

## Why it matters

Turns ad-hoc LLM prompts into versionable, executable artifacts you can drop into `$PATH` alongside regular shell scripts and call from cron, git hooks, or other tools — without writing wrapper code or a custom CLI.

## Who it's for

Developers already using Simon's `llm` CLI; shell-heavy automators building one-off agentic pipelines.

## Try it

uv tool install llm

## Links

- [Blog Post](https://simonwillison.net/2026/May/11/llm-shebang/)
- [LLM CLI Docs](https://llm.datasette.io/en/stable/)
