plugins/bash-development/skills/bash-52-features/SKILL.md
Bash 5.2 release features and improvements with practical examples. Use when working with Bash 5.2 features, variable handling enhancements, readline improvements, or when user asks about Bash 5.2 changes, new features, or version-specific capabilities.
npx skillsauth add jamie-bitflight/claude_skills bash-52-featuresInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Released in September 2022, Bash 5.2 brought enhancements to variable handling, readline integration, array support, and numerous bug fixes.
Better error messages and more consistent behavior:
# More informative error messages for readonly variables
readonly CONFIG_PATH="/etc/app/config"
# Attempting to modify generates clearer error
CONFIG_PATH="/tmp/config" # bash: CONFIG_PATH: readonly variable
# Better handling of unset variables with set -u
set -u
# Checking before use is now more reliable
if [[ -n "${OPTIONAL_VAR:-}" ]]; then
echo "Variable is set: ${OPTIONAL_VAR}"
else
echo "Variable is not set"
fi
# Practical example: Configuration validation
validate_config() {
local -a required_vars=("DATABASE_URL" "API_KEY" "LOG_DIR")
local var
for var in "${required_vars[@]}"; do
if [[ -z "${!var:-}" ]]; then
printf 'Error: Required variable %s is not set\n' "${var}" >&2
return 1
fi
done
echo "All required configuration variables are set"
}
export DATABASE_URL="postgres://localhost/db"
export API_KEY="secret123"
export LOG_DIR="/var/log/app"
validate_config
Enhanced reference variable handling.
Code examples
Significant improvements to command-line editing:
# Better completion behavior in ~/.inputrc
# Skip completions for invisible characters
set skip-completed-text on
# Enhanced history search
# Cycle through history with prefix matching
bind '"\e[A": history-search-backward' # Up arrow
bind '"\e[B": history-search-forward' # Down arrow
# Improved completion coloring
set colored-stats on
set colored-completion-prefix on
# Better handling of long completions
set completion-display-width 0 # Use full terminal width
Code examples
# Improved array slicing and expansion
array=(10 20 30 40 50 60 70 80 90)
# Slice notation is more reliable
echo "First 3: ${array[@]:0:3}" # 10 20 30
echo "Last 3: ${array[@]: -3}" # 70 80 90
echo "Middle: ${array[@]:3:3}" # 40 50 60
# Practical example: Batch processing
process_batch() {
local -a items=("$@")
local batch_size=3
local i
for ((i = 0; i < ${#items[@]}; i += batch_size)); do
local -a batch=("${items[@]:i:batch_size}")
printf 'Processing batch %d: %s\n' \
"$((i / batch_size + 1))" \
"${batch[*]}"
# Process batch items...
for item in "${batch[@]}"; do
echo " Processing: ${item}"
done
done
}
files=(file1 file2 file3 file4 file5 file6 file7)
process_batch "${files[@]}"
Code examples
Code examples
Code examples
Bash 5.2 includes several security-related fixes:
Code examples
# Benchmark example showing improved performance
benchmark_arrays() {
local -a array
local i
local start end
start="${EPOCHREALTIME}"
# Large array operations are faster in 5.2
for ((i = 0; i < 10000; i++)); do
array+=("item_${i}")
done
end="${EPOCHREALTIME}"
printf 'Array population time: %.4f seconds\n' \
"$(awk "BEGIN {print ${end} - ${start}}")"
echo "Array size: ${#array[@]}"
}
benchmark_arrays
Generally backward compatible, but note:
# Check for Bash 5.2 features
if [[ "${BASH_VERSINFO[0]}" -eq 5 ]] && [[ "${BASH_VERSINFO[1]}" -ge 2 ]]; then
echo "Bash 5.2+ features available"
# Use enhanced features
elif [[ "${BASH_VERSINFO[0]}" -ge 6 ]]; then
echo "Bash 6.0+ detected"
else
echo "Bash version too old for 5.2 features"
fi
Most scripts work without modification, but consider:
Code examples
For broader Bash development patterns and best practices, see:
development
When an application needs to store config, data, cache, or state files. When designing where user-specific files should live. When code writes to ~/.appname or hardcoded home paths. When implementing cross-platform file storage with platformdirs.
testing
Enforce mandatory pre-action verification checkpoints to prevent pattern-matching from overriding explicit reasoning. Use this skill when about to execute implementation actions (Bash, Write, Edit) to verify hypothesis-action alignment. Blocks execution when hypothesis unverified or action targets different system than hypothesis identified. Critical for preventing cognitive dissonance where correct diagnosis leads to wrong implementation.
tools
Reference guide for the Twelve-Factor App methodology — 15 principles (12 original + 3 modern extensions) for building portable, resilient, cloud-native applications. Use when evaluating application architecture, designing cloud-native services, reviewing codebases for methodology compliance, advising on configuration, scaling, observability, security, and deployment patterns. Incorporates the 2025 open-source community evolution and cloud-native reinterpretations of each factor.
tools
Converts user-facing documentation (how-to guides, tutorials, API references, examples) in any format — Markdown, PDF, DOCX, PPTX, XLSX, AsciiDoc, RST, HTML, Jupyter notebooks, man pages, TOML/YAML/JSON configs, and plain text — into Claude Code skill directories with SKILL.md plus thematically grouped references/*.md files. Use when given a docs directory or mixed-format documentation to transform into an AI skill. Uses MCP file-reader server for binary formats.