generic_bash_style

A Bash scripting rule that specifies required headers, safety settings, conditional debugging, and color-aware logging functions.

In plain words
What is it for?
Use it when writing or reviewing Bash scripts that need the required shebang, options, debug handling, and logging functions.
Why use it?
It makes shell scripts follow a consistent format and behave more predictably during errors and debugging.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/ivangrynenko/cursorrules/generic_bash_style
Clone the repo
git clone --depth 1 https://github.com/ivangrynenko/cursorrules

Made for: Cursor.

Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 902 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00009 $0.00902
Opus 5 $0.00005 $0.00451
Sonnet 5 $0.00002 $0.00180
Haiku 4.5 $0.00001 $0.00090

Measured yesterday against content hash a58d39ea8498, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

generic_bash_style scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.cursor/rules/generic_bash_style.mdc · 52 lines

How it starts

The opening of the file, as written. The whole thing — 52 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Enhanced Bash Scripting Standard with Colorized Logging

This rule enforces best practices for writing Bash scripts, with an emphasis on using colorized logging for better output readability.

Rule Details

  • Name: enhanced_bash_style

  • Description: Enforce Bash scripting standards with colorized logging

Filters

  • file extension pattern: \\.sh$

Enforcement Checks

  • Conditions:
    • pattern ^#!/usr/bin/env bash$ – All scripts should start with the shebang '#!/usr/bin/env bash'.
    • pattern ^set -eu$ – Enable 'set -eu' for script robustness.
    • pattern ^set -x$ – negated ^\\[ \"\\${DEBUG-}\" = \"1\" ] && set -x$ – Use conditional 'set -x' based on debug flag.
    • pattern ^# @formatter:off$ – Start of formatting block for log functions.
    • pattern note\\(\\) { printf \" %s\\n\" \"\\${1}\"; }$ – Include 'note' function for plain messages.
    • pattern info\\(\\) { \\[ \"\\${TERM:-}\" != \"dumb\" ] && tput colors >/dev/null 2>&1 && printf \"\\\\033\\[34m\\[INFO] %s\\\\033\\[0m\\n\" \"\\${1}\" || printf \"\\[INFO] %s\\n\" \"\\${1}\"; }$ – Include 'info' function for blue informational messages.
    • pattern pass\\(\\) { \\[ \"\\${TERM:-}\" != \"dumb\" ] && tput colors >/dev/null 2>&1 && printf \"\\\\033\\[32m\\[ OK ] %s\\\\033\\[0m\\n\" \"\\${1}\" || printf \"\\[ OK ] %s\\n\" \"\\${1}\"; }$ – Include 'pass' function for green success messages.
    • pattern fail\\(\\) { \\[ \"\\${TERM:-}\" != \"dumb\" ] && tput colors >/dev/null 2>&1 && printf \"\\\\033\\[31m\\[FAIL] %s\\\\033\\[0m\\n\" \"\\${1}\" || printf \"\\[FAIL] %s\\n\" \"\\${1}\"; }$ – Include 'fail' function for red error messages.
    • pattern warn\\(\\) { \\[ \"\\${TERM:-}\" != \"dumb\" ] && tput colors >/dev/null 2>&1 && printf \"\\\\033\\[33m\\[WARN] %s\\\\033\\[0m\\n\" \"\\${1}\" || printf \"\\[WARN] %s\\n\" \"\\${1}\"; }$ – Include 'warn' function for yellow warning messages.
    • pattern ^# @formatter:on$ – End of formatting block for log functions.

Suggestions

  • Guidance: Bash Scripting Best Practices:
  • Error Handling: Use set -eu to catch errors and undefined variables early.
  • Debugging: Implement conditional debugging with set -x using a DEBUG variable.
  • Logging Functions: Use colorized logging for better script output readability:
    • note() for plain notes
    • info() for blue informational messages
    • pass() for green success messages
    • fail() for red error messages
    • warn() for yellow warnings, ensuring users can distinguish different types of messages easily
  • Security: Avoid using eval or similar constructs; use safe alternatives.
  • Documentation: Include descriptive comments, especially for complex logic.
  • Portability: Use /usr/bin/env bash for the shebang to ensure script runs with bash on any system.
  • Variable Checks: Ensure necessary variables are set, enhancing script reliability.
  • Exit Codes: Use explicit exit codes for different failure scenarios.
  • Color Support: Ensure logging functions check for terminal color support before applying colors.

Read the full file on GitHub · 52 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 52 lines · 9 tokens per session scan A a58d39ea8498

Subscribe to this mod's changes

generic_bash_style is a cursor rule published in the GitHub repository ivangrynenko/cursorrules (87 stars, last pushed 10mo ago), licensed MIT. It adds 9 tokens to every session and 902 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.