AIToday
Large Language ModelsSimon Willison's WeblogPublished: May 12, 2026, 07:02 JST1 min read

Simon Willison demonstrates using LLM in shell script shebangs to generate content and run tools

3 Key Points

  1. LLM (an AI tool that generates text) can be invoked directly from a script's shebang line using the pattern `#!/usr/bin/env -S llm -f`, allowing a text file to function as an executable prompt.

  2. The approach supports tool calls via the `-T` option and YAML template execution via the `-t` option, which can define custom Python functions like `add()` and `multiply()` for the LLM to invoke during execution.

  3. Example use case: a script can accept a math expression like `'what is 2344 * 5252 + 134'` and output both the tool calls made and the final result (`12,310,822`).

Ask the AI about this article →

Simon Willison's WeblogRead Original Article

Get the latest Large Language Models news every morning

For example, today's edition would include:

  • Anthropic resets Claude usage limits with Fable 5.1 launchITmedia AI+ · 2h ago
  • Salesforce and Anthropic unveil Claudeforce, integrating CRM into ClaudePublickey · 2h ago
  • Anthropic releases Claude Fable 5.1 and Mythos 5.1ITmedia AI+ · 5h ago

AI-summarized, only the topics you pick — one digest a day via Email, Slack, or Discord.

Free · takes 30 seconds · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. Q&As are published on this page for other readers too.

Related Articles

Next articleOpenAI establishes new subsidiary to deploy consultants and engineers to customer companies, with stakes held by TPG, Bain Capital, Advent International, and Brookfield.