github.com

Show HN: Bash4LLM+ – A lightweight, dependency-free Bash wrapper for LLM APIs

kamaludu · 60 points · 25 comments · kemarin dulu

Bash4LLM is a single-file Bash wrapper for interacting with LLMs from the terminal. I created it because I wanted something simple that worked without installing Python, Node, or any other runtime. It uses only Bash, curl, and jq. You can send prompts, start a small chat, process files line by line, stream output, and save session metadata in JSON format. I tried to make it safe and predictable: no use of the system /tmp, no use of eval. Groq is supported by default, and other providers can be added with dedicated Bash scripts in the extras/providers/ folder. Example: echo "explains the command: ls -l" | ./bash4llm

Comments

5 preview comments · loading full thread
Chu4eenokemarin dulu

You really should either just write it manually, or at least clean it up, 5kLOC of bash for POSTing and reading/writing files is a bit overkill (the code is extremely repetitive, verbose and just hard to follow).

cloudkj21 jam yang lalu

Heh, I just wrote something very similar - bash, curl, and jq scripts that wrap local Ollama calls to produce a REPL/agent: https://github.com/cloudkj/llayer Seems like the core idea is the same, but I took it farther down the Unix philosophy line of thinking and tried to make the individual components small and composable. Feel free to check it out and compare!

kamaludukemarin

I've applied a set of corrections, on Bash4LLM core, to reduce redundancy and make the flow more deterministic. Optimized safe_mkdir to eliminate superfluous calls to chmod, simplify temp file management by removing a redundant pre‑validation, remove repeated controls on ensure_run_tmpdir, unified internal standards but with backward compatibility, to correct duplications on providers management caused by a second redundant scan of provider modules, preserved diagnostic mode (CLI and environment variables). These are small jobs, but useful for clean and consistent runtime.

athrowaway3zkemarin dulu

You need to figure out how to prompt to get much more concise code. This is just a casual scroll through for 2 seconds at function names i recognize and can tell are crap. https://github.com/kamaludu/bash4llm/blob/d7258163dc1cbeb6ae... https://github.com/kamaludu/bash4llm/blob/d7258163dc1cbeb6ae... https://github.com/kamaludu/bash4llm/blob/d7258163dc1cbeb6ae... Sorry but this is crap. If you trust it to be an entirely self-contained abstraction that is fine. But if I'm building a brick house, and smash open 1 of the bricks, i dont want it to look this shoddy. Any LLM you point at it, is going to be drastically dumber in editing it or auditing it because it needs to first parse all the crap a previous LLM generated. The fewer lines of code things use the better - it keeps models smarter when it matters. Plus it saves money in the long run.

bonigvkemarin

oh! I thought this was like bash w/o verbosity. That is a tool I would love to see. bash4llm . May be llike Gandhi said - I should be the change you want to see!