Menu

Post image 1
Post image 2
1 / 2
0

Your text file is the prompt now: LLM's shebang trick

DEV Community·Andrew Kew·22 days ago
#x1xmsGiX
#ai#llm#cli#fullscreen#tools#file
Reading 0:00
15s threshold

Simon Willison's llm CLI tool already does a lot — run prompts, manage models, call tools, store logs in SQLite. But a Hacker News comment last week sent him down a rabbit hole, and the result is one of those tricks that makes you stop and stare. You can now put llm in a shebang line and make a plain text file directly executable. "But seriously, you can put a shebang on an english text file now (if you're sufficiently brave) [...]" — Kim_Bruning, Hacker News What this actually looks like The simplest form uses llm 's fragments mechanism ( -f ), which reads the file's contents as a prompt: #!/usr/bin/env -S llm -f Generate an SVG of a pelican riding a bicycle Enter fullscreen mode Exit fullscreen mode Save it, chmod +x , run it. That's it. The file IS the prompt. The -S flag on env is the key detail — without it, env treats llm -f as a single command name and errors out. With -S , it splits the arguments correctly before handing off to llm . Want to suppress model commentary and return only the code block?…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More