🛠️How to Put an LLM in a Script's Shebang Line
TL;DR
Simon Willison shows how to use his llm CLI in a script's shebang line so the file itself becomes an LLM-powered program. The short TIL walks through the exact syntax and a working example you can copy.
Simon Willison shows how to use his llm CLI in a script's shebang line so the file itself becomes an LLM-powered program. The short TIL walks through the exact syntax and a working example you can copy.
Key Points
Uses an 'env -S llm ...' style shebang to run a prompt as an executable file
Turns a plain text file into a runnable LLM program with no wrapper code
Passes the script body to the llm tool as the prompt
Posted as a TIL on May 11, 2026
Why It Matters
It is a tiny, copyable trick showing how close LLM tooling now sits to ordinary Unix scripting.
Quick Facts
Comments
Be the first to comment
Enjoyed this article?
Get it daily. 7am. Free. Reads in 5 minutes.
Join 3,484 builders reading daily.