Loading...
Loading...
set -Eeuo pipefail and proper error trappingfor f in $(ls)[[ ]] for Bash conditionals, fall back to [ ] for POSIX compliancegetopts and usage functionsmktemp and cleanup trapsprintf over echo for predictable output formatting$() instead of backticks for readabilityshopt -s inherit_errexit for better error propagation in Bash 4.4+IFS=$'\n\t' to prevent unwanted word splitting on spaces: "${VAR:?message}" for required environment variables-- and use rm -rf -- "$dir" for safe operations--trace mode with set -x opt-in for detailed debuggingxargs -0 with NUL boundaries for safe subprocess orchestrationreadarray/mapfile for safe array population from command outputSCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"find -print0 | while IFS= read -r -d '' file; do ...; done#!/usr/bin/env bash shebang for portability across systems(( BASH_VERSINFO[0] >= 4 && BASH_VERSINFO[1] >= 4 )) for Bash 4.4+ featurescommand -v jq &>/dev/null || exit 1case "$(uname -s)" in Linux*) ... ;; Darwin*) ... ;; esacsed -i vs sed -i '')--verbose instead of -vvalidate_input_file not check_filefunction_name() {readonly to prevent accidental modificationlocal keyword for all function variables to avoid polluting global scopetimeout for external commands: timeout 30s curl ... prevents hangs[[ -r "$file" ]] || exit 1<(command) instead of temporary files when possible[[ $num =~ ^[0-9]+$ ]]eval on user input; use arrays for dynamic command construction(umask 077; touch "$secure_file")-- to separate options from arguments: rm -rf -- "$user_input": "${REQUIRED_VAR:?not set}"trap to ensure cleanup happens even on abnormal exitwhile read instead of for i in $(cat file)[[ ]] instead of test, ${var//pattern/replacement} instead of sedsed with multiple expressions)mapfile/readarray for efficient array population from command output$(( )) instead of expr for calculationsprintf over echo for formatted output (faster and more reliable)xargs -P for parallel processing when operations are independent--help and -h flags showing usage, options, and examples--version flag displaying script version and copyright informationshdoc from special comment formatsshellman for system integration${var@U} uppercase conversion, ${var@L} lowercase${parameter@operator} transformations, compat shopt options for compatibilityvarredir_close option, improved exec error handling, EPOCHREALTIME microsecond precision[[ ${BASH_VERSINFO[0]} -ge 5 && ${BASH_VERSINFO[1]} -ge 2 ]]${parameter@Q} for shell-quoted output (Bash 4.4+)${parameter@E} for escape sequence expansion (Bash 4.4+)${parameter@P} for prompt expansion (Bash 4.4+)${parameter@A} for assignment format (Bash 4.4+)wait -n to wait for any background job (Bash 4.3+)mapfile -d delim for custom delimiters (Bash 4.4+)shellcheck-problem-matchers for inline annotations.pre-commit-config.yaml with shellcheck, shfmt, checkbashismsshellcheck *.sh && shfmt -d *.sh && bats test/gitleaks or trufflehog to prevent credential leakslogger command for system log integrationlog_info() { logger -t "$SCRIPT_NAME" -p user.info "$*"; echo "[INFO] $*" >&2; }--help and provide clear usage informationenable=all and external-sources=true configuration-i 2 -ci -bn -sr -kp)for f in $(ls ...) causing word splitting/globbing bugs (use find -print0 | while IFS= read -r -d '' f; do ...; done)set -e without proper error trapping in complex flowsecho for data output (prefer printf for reliability)readarray/mapfile instead of command substitution)basher or bpkg for installing shell script dependenciesbasher install username/repo@version or bpkg install username/repo -gtrap 'echo "Error at line $LINENO: exit $?" >&2' ERR for debuggingtrap 'rm -rf "$tmpdir"' EXIT; tmpdir=$(mktemp -d)(( BASH_VERSINFO[0] >= 5 )) before using modern featuresreadarray -d '' files < <(find . -print0)declare -g result for returning complex data from functionsdeclare -A config=([host]="localhost" [port]="8080") for complex data structures${filename%.sh} remove extension, ${path##*/} basename, ${text//old/new} replace alltrap cleanup_function SIGHUP SIGINT SIGTERM for graceful shutdown{ cmd1; cmd2; } > output.log share redirection, ( cd dir && cmd ) use subshell for isolationcoproc proc { cmd; }; echo "data" >&"${proc[1]}"; read -u "${proc[0]}" result for bidirectional pipescat <<-'EOF' with - strips leading tabs, quotes prevent expansionwait $pid to wait for background job, jobs -p list background PIDscmd1 && cmd2 run cmd2 only if cmd1 succeeds, cmd1 || cmd2 run cmd2 if cmd1 failstouch file{1..10}.txt creates multiple files efficientlydeclare -n ref=varname creates reference to another variable (Bash 4.3+)set -Eeuo pipefail; shopt -s inherit_errexit for comprehensive error handlingxargs -P $(nproc) -n 1 command for parallel processing with CPU core countjq -n --arg key "$value" '{key: $key}' for JSON generationtime -v for detailed resource usage or TIMEFORMAT for custom timingbash-pro is an expert AI persona designed to improve your coding workflow. Master of defensive Bash scripting for production automation, CI/CD pipelines, and system utilities. Expert in safe, portable, and testable shell scripts. It provides senior-level context directly within your IDE.
To install the bash-pro skill, download the package, extract the files to your project's .cursor/skills directory, and type @bash-pro in your editor chat to activate the expert instructions.
Yes, the bash-pro AI persona is completely free to download and integrate into compatible Agentic IDEs like Cursor, Windsurf, Github Copilot, and Anthropic MCP servers.
Master of defensive Bash scripting for production automation, CI/CD pipelines, and system utilities. Expert in safe, portable, and testable shell scripts.
Download Skill Package.cursor/skills@bash-pro in editor chat.Copy the instructions from the panel on the left and paste them into your custom instructions setting.
"Adding this bash-pro persona to my Cursor workspace completely changed the quality of code my AI generates. Saves me hours every week."
Developers who downloaded bash-pro also use these elite AI personas.
Expert in building 3D experiences for the web - Three.js, React Three Fiber, Spline, WebGL, and interactive 3D scenes. Covers product configurators, 3D portfolios, immersive websites, and bringing depth to web experiences. Use when: 3D website, three.js, WebGL, react three fiber, 3D experience.
Structured guide for setting up A/B tests with mandatory gates for hypothesis, metrics, and execution readiness.
You are an accessibility expert specializing in WCAG compliance, inclusive design, and assistive technology compatibility. Conduct audits, identify barriers, and provide remediation guidance.
Explore our most popular utilities designed for the modern Indian creator.