본문으로 건너뛰기
cccskills
무료GitHub에 공개

bash-52-features

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.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md5.9 KB
  • references/code-examples.md3.9 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Bash 5.2 Features and Improvements

Released in September 2022, Bash 5.2 brought enhancements to variable handling, readline integration, array support, and numerous bug fixes.

Variable Handling Enhancements

Improved Readonly and Unset Variable Behavior

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

Nameref Improvements

Enhanced reference variable handling.

Code examples

Readline 8.2 Integration

Significant improvements to command-line editing:

Enhanced Completion and History

# 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

Input Handling Improvements

Code examples

Array Support Enhancements

Better Indexed Array Operations

# 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[@]}"

Associative Array Improvements

Code examples

Parameter Expansion Enhancements

Improved Pattern Matching

Code examples

Enhanced Substring Operations

Code examples

Security Fixes

Bash 5.2 includes several security-related fixes:

  • Improved handling of environment variable inheritance
  • Better validation of variable names
  • Enhanced protection against command injection in certain contexts

Code examples

Performance Improvements

  • Faster variable expansion in complex scenarios
  • Optimized array operations for large arrays
  • Reduced memory footprint for associative arrays
  • Improved efficiency in pattern matching
# 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

Compatibility Notes

Upgrading from Bash 5.1

Generally backward compatible, but note:

  • Some edge cases in variable expansion have changed behavior
  • Error messages are more detailed (may affect scripts parsing stderr)
  • Readline behavior changes might affect interactive scripts

Version Check

# 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

Migration Tips

From Bash 5.1 to 5.2

Most scripts work without modification, but consider:

Code examples

References

Additional Resources

For broader Bash development patterns and best practices, see:

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Add automated documentation updater to any Claude skill. Creates a Python sync script that downloads upstream docs, processes markdown for AI consumption, and maintains local cache with configurable refresh. Collects template variables, then delegates implementation through 5-phase workflow. Use when adding auto-updating reference documentation to plugins or skills.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Jamie-BitFlight/claude_skills672026년 10월 20일 업데이트

SAM-style feature initiation workflow — discovery through codebase analysis, architecture spec, task decomposition, validation, and context manifest. Use when a user asks to add a feature, plan a feature, or convert an idea into an executable SAM plan.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Jamie-BitFlight/claude_skills672026년 10월 20일 업데이트

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.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Jamie-BitFlight/claude_skills672026년 10월 20일 업데이트

Browser automation for AI agents using the agent-browser CLI and Playwright. Use when navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, logging into sites, or automating any browser task. Triggers on "open a website", "fill out a form", "click a button", "scrape data", "test this web app", "automate browser actions", or any programmatic web interaction request.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Jamie-BitFlight/claude_skills672026년 10월 20일 업데이트

Runs the description-drift experiment — spawns all Claude Code agents simultaneously to collect self-reported capabilities, then compares them against static frontmatter descriptions to reveal how reliable orchestrator routing based on descriptions actually is. Use when measuring description drift across the agent fleet, re-running the capability collection experiment, analyzing a specific agent's self-reported capabilities, or auditing whether frontmatter descriptions accurately reflect agent behavior.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Jamie-BitFlight/claude_skills672026년 10월 20일 업데이트

Create or adapt Claude Code agent definitions. Use when creating an agent, changing subagent configuration, selecting agent scope, or designing a specialized delegation role.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Jamie-BitFlight/claude_skills672026년 10월 20일 업데이트

Jamie-BitFlight의 스킬 모두 보기

이 스킬의 문제 신고