Agent skill
bash-53-features
Bash 5.3 release features and improvements with practical examples. Use when working with Bash 5.3 features, new command substitution, GLOBSORT, loadable builtins, or when user asks about Bash 5.3 changes, new features, or version-specific capabilities.
Install this agent skill to your Project
npx add-skill https://github.com/Jamie-BitFlight/claude_skills/tree/main/plugins/bash-development/skills/bash-53-features
SKILL.md
Bash 5.3 Features and Improvements
Released in July 2025, Bash 5.3 introduces significant enhancements including revolutionary command substitution syntax, new variables, loadable builtins, and improved C standard conformance.
Revolutionary Command Substitution
Efficient In-Shell Execution: ${ command; }
Execute commands without forking, dramatically improving performance:
# Traditional command substitution (creates subshell)
result=$(echo "Hello, World")
# NEW: In-shell command substitution (no fork!)
# Note: a space (or tab/newline/|) is required after the opening '{'
result=${ echo "Hello, World"; }
# Practical example: Fast variable assignment
config_value=${ grep "^timeout=" config.txt | cut -d= -f2; }
# Performance comparison function
benchmark_substitution() {
local i
local start end
echo "Testing traditional substitution..."
start="${EPOCHREALTIME}"
for ((i = 0; i < 1000; i++)); do
result=$(echo "${i}")
done
end="${EPOCHREALTIME}"
printf 'Traditional: %.4f seconds\n' \
"$(awk "BEGIN {print ${end} - ${start}}")"
echo "Testing new in-shell substitution..."
start="${EPOCHREALTIME}"
for ((i = 0; i < 1000; i++)); do
result=${ echo "${i}"; }
done
end="${EPOCHREALTIME}"
printf 'In-shell: %.4f seconds\n' \
"$(awk "BEGIN {print ${end} - ${start}}")"
}
benchmark_substitution
Benefits:
- No subprocess creation overhead
- Significantly faster for simple commands
- Reduced resource usage in loops
- Same syntax familiarity as command substitution
REPLY Variable Capture: ${| command; }
Execute commands and automatically store output in REPLY. Note: REPLY is local to the
substitution — its value is restored after completion, so capture it immediately:
Code examples
Benefits:
- Cleaner code without intermediate variables
- Consistent capture mechanism
- Reduced visual clutter
- Perfect for rapid prototyping
Use Cases Comparison
# String manipulation - use in-shell for efficiency
filename="document.txt"
basename=${ echo "${filename%.*}"; }
extension=${ echo "${filename##*.}"; }
# Output capture - use REPLY for clarity
${| df -h / | tail -1 | awk '{print $5}'; }
disk_usage="${REPLY}"
echo "Disk usage: ${disk_usage}"
# Complex pipelines - traditional might still be clearer
result=$(cat file.txt | grep pattern | sort | uniq)
GLOBSORT Variable
Control the sorting order of filename and pathname expansion. The specifier is optionally
prefixed with + (ascending, default) or - (descending):
Code examples
Available sort specifiers:
name— Alphabetical by filenamesize— By file sizemtime— By modification timeatime— By access timectime— By inode change timeblocks— By allocated block countnumeric— Numeric sort on leading digits in filenamenosort— Disable sorting (glob order)- Prefix:
+(ascending, default) or-(descending)
Enhanced Builtins
compgen with Variable Storage
Store completions directly in a variable:
Code examples
read with Readline Completion (-E)
Interactive input with autocompletion:
# Enable readline completion during read
choose_file() {
local file
echo "Enter filename (tab for completion):"
read -e -r -E -p "> " file
if [[ -f "${file}" ]]; then
echo "Selected: ${file}"
return 0
else
echo "File not found: ${file}"
return 1
fi
}
choose_file
# Practical example: Interactive configuration
configure_app() {
local config_file
echo "Select configuration file:"
read -e -r -E -p "Config: " config_file
if [[ -f "${config_file}" ]]; then
${| grep -c "^[^#]" "${config_file}"; }
local line_count="${REPLY}"
echo "Found ${line_count} active configuration lines"
fi
}
source with Path (-p)
Specify search path for sourced scripts:
Code examples
printf Enhancements
New options for multibyte strings and representations:
# Enhanced printf options
printf '%q\n' "string with spaces" # Shell-quoted output
# NEW: Multibyte string support improvements
text="Hello, 世界"
printf 'Length: %d bytes\n' "${#text}"
# Practical example: Safe command construction
build_command() {
local -a args=("$@")
local arg cmd=""
for arg in "${args[@]}"; do
cmd+=$(printf '%q ' "${arg}")
done
echo "Safe command: ${cmd}"
}
build_command ls "-l" "file with spaces.txt"
New Loadable Builtins
kv - Key-Value Arrays
Create associative arrays from key-value data. Note: The kv builtin existence is
confirmed in Bash 5.3; the exact interface shown below is illustrative — verify with
help kv after loading:
Code examples
strptime - Date Parsing
Parse textual dates into Unix timestamps. Note: The strptime builtin existence is
confirmed in Bash 5.3; the exact interface shown below is illustrative — verify with
help strptime after loading:
Code examples
fltexpr - Floating-Point Calculations
Perform floating-point arithmetic without external tools:
Code examples
POSIX Mode Improvements
Enhanced POSIX compliance:
# Enable POSIX mode
set -o posix
# String comparisons now follow locale rules
[[ "ä" < "z" ]] # Locale-dependent comparison
# Improved POSIX conformance in builtins
# test, trap, wait, bind all more strictly conformant
# Practical example: Portable script header
#!/usr/bin/env bash
if [[ "${BASH_VERSINFO[0]}" -ge 5 ]] && [[ "${BASH_VERSINFO[1]}" -ge 3 ]]; then
# Bash 5.3+ available, use modern features
USE_MODERN_FEATURES=1
else
# Fall back to POSIX mode for portability
set -o posix
USE_MODERN_FEATURES=0
fi
Improved Error Reporting
More detailed error messages:
Code examples
C Standard Conformance Improvements
Bash 5.3 improves conformance to modern C standards (the build minimum remains C90):
- No longer compiles with K&R C compilers
- Modernized codebase for better conformance
- Better optimization opportunities
- Improved type safety
Note: This primarily affects developers compiling Bash from source, not end users.
Performance Improvements
- Command substitution without forking (
${ cmd; }) dramatically reduces overhead - Optimized globbing with
GLOBSORT - Faster builtin operations
- Reduced memory usage in various operations
# Benchmark: Traditional vs new substitution
benchmark() {
local iterations=10000
local i start end
start="${EPOCHREALTIME}"
for ((i = 0; i < iterations; i++)); do
result=$(echo test)
done
end="${EPOCHREALTIME}"
printf 'Traditional: %.4f seconds\n' \
"$(awk "BEGIN {print ${end} - ${start}}")"
start="${EPOCHREALTIME}"
for ((i = 0; i < iterations; i++)); do
result=${echo test;}
done
end="${EPOCHREALTIME}"
printf 'In-shell: %.4f seconds\n' \
"$(awk "BEGIN {print ${end} - ${start}}")"
}
benchmark
Migration Guide
From Bash 5.2 to 5.3
Most scripts compatible, but consider:
# Take advantage of new command substitution for performance
# OLD:
for file in *; do
size=$(stat -f%z "${file}" 2>/dev/null)
done
# NEW (faster):
for file in *; do
${| stat -f%z "${file}" 2>/dev/null; }
size="${REPLY}"
done
# Use GLOBSORT for better file processing
GLOBSORT="-mtime"
for file in *.log; do
process_recent_log "${file}"
done
# Leverage new builtins where appropriate
# Instead of: awk calculation
# Use: fltexpr for floating-point math
Version Detection
# Check for Bash 5.3 features
if [[ "${BASH_VERSINFO[0]}" -ge 5 ]] && [[ "${BASH_VERSINFO[1]}" -ge 3 ]]; then
echo "Bash 5.3+ features available"
CAN_USE_INSITU_SUBSTITUTION=1
CAN_USE_GLOBSORT=1
else
echo "Bash version: ${BASH_VERSION}"
CAN_USE_INSITU_SUBSTITUTION=0
CAN_USE_GLOBSORT=0
fi
References
- Bash NEWS file - Official release notes
- GNU Bash 5.3 Release - Source distribution
- Bash 5.3 Announcement - Release coverage
- Readline 8.3 Documentation - Readline improvements
Additional Resources
For broader Bash development patterns and best practices, see:
- ../bash-development/SKILL.md - Core Bash development patterns
- ../bash-51-features/SKILL.md - Bash 5.1 features
- ../bash-52-features/SKILL.md - Bash 5.2 features
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
ccc
This skill should be used when code search is needed (whether explicitly requested or as part of completing a task), when indexing the codebase after changes, or when the user asks about ccc, cocoindex-code, or the codebase index. Trigger phrases include 'search the codebase', 'find code related to', 'update the index', 'ccc', 'cocoindex-code'.
agent-browser
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction.
delegate
Quick delegation template for sub-agent prompts. Use when assigning work to a sub-agent, before invoking the Agent tool, or when preparing prompts for specialized agents. Provides the WHERE-WHAT-WHY framework. For comprehensive delegation guidance, activate the agent-orchestration how-to-delegate skill.
swarm-spawning
Spawn agents and teammates in Claude Code swarms. Use when choosing between subagents vs teammates, selecting agent types (Explore, Plan, general-purpose, plugin agents), configuring spawn backends (in-process, tmux, iterm2), or setting environment variables for spawned agents.
knowledge-explorer
Manage the research/ knowledge base (KB) of tool and library research entries. Use when browsing KB topics, adding new research entries, updating existing entries with dated revisions, fetching GitHub repo metadata into a draft KB entry, or migrating old-format entries to skill-spec frontmatter. Triggers on tasks like "what do we have on X", "add this to the KB", "update the KB entry for Y", "fetch github info for owner/repo", or "migrate old entries".
design-anti-patterns
Enforce anti-AI UI design rules based on the Uncodixfy methodology. Use when generating HTML, CSS, React, Vue, Svelte, or any frontend UI code. Prevents "Codex UI" — the generic AI aesthetic of soft gradients, floating panels, oversized rounded corners, glassmorphism, hero sections in dashboards, and decorative copy. Applies constraints from Linear/Raycast/Stripe/GitHub design philosophy: functional, honest, human-designed interfaces. Triggers on: UI generation, dashboard building, frontend component creation, CSS styling, landing page design, or any task producing visual interface code.
Didn't find tool you were looking for?