$ recombobulate _
home / tips / run-claude-code-non-interactively-with-print
0

Run Claude Code Non-Interactively with --print

bagwaa @bagwaa · Mar 26, 2026 · Configuration
run-claude-code-non-interactively-with-print

The --print flag (short: -p) lets you fire a one-shot prompt at Claude and get the response on stdout — no interactive session, no prompts, no fuss.

claude --print "Summarise the changes in the last git commit"

This is the mode you want for shell scripts, Makefiles, and CI jobs where you need Claude's output as an ingredient in a larger pipeline. Combine it with --output-format json when you need structured, machine-parseable responses.

# Pipe a file into Claude for analysis
claude -p "What does this file do and are there any obvious bugs?" < src/api/handler.ts

# Use the output in a script variable
SUMMARY=$(claude -p "List every TODO comment in this file" < app.js)
echo "$SUMMARY" | grep -i "critical"

# JSON output for scripting
claude --print --output-format json "Review this function for security issues" < src/auth.ts \
  | jq '.result'

Non-interactive mode also plays nicely with --allowedTools so you can lock down exactly which tools Claude is permitted to use during the run — useful when you want file reads but not writes in a pipeline.

--print turns Claude into a proper UNIX citizen that slots cleanly into any automation script.

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Switch to the Stable Update Channel with autoUpdatesChannel

The autoUpdatesChannel setting pins Claude Code to a stable release track that skips versions with major regressions.

bagwaa @bagwaa · 1 hour ago
0
Set Claude's Response Language with the language Setting

The language setting makes Claude respond in your preferred language by default, across every session and project.

bagwaa @bagwaa · 1 hour ago
0
Customize or Remove Claude's Git Attribution with the attribution Setting

The attribution setting lets you customize or completely remove Claude's Co-Authored-By trailer from git commits and pull requests.

bagwaa @bagwaa · 1 hour ago