AIToday

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

Simon Willison's WeblogMay 11, 20261 min read

Summaries like this, in your inbox every morning.

Sign up free →

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`).

Discussion

No comments yet. Be the first to share your thoughts!

Log in to join the discussion

Related Articles

Stay ahead with AI news

Get curated AI news from 200+ sources delivered daily to your inbox. Free to use.

Get Started Free

Free · takes 30 seconds · unsubscribe anytime

1 minute a day. The AI essentials.

200+ sources · Email / LINE / Slack

Get it free →