Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

bash-53-features

БесплатноБез исполняемых скриптовНе проверен

Bash 5.3 new features and modern patterns (2025). PROACTIVELY activate for: (1) Bash 5.3 specific features (BASH_TRAPSIG, in-shell command substitution, ${|}…

JosiahSiegelот JosiahSiegel★ 67 звёзд на GitHub

Об этом скилле

🚨 CRITICAL GUIDELINES

Windows File Path Requirements

MANDATORY: Always Use Backslashes on Windows for File Paths

When using Edit or Write tools on Windows, you MUST use backslashes (\) in file paths, NOT forward slashes (/).

Examples:

  • ❌ WRONG: D:/repos/project/file.tsx
  • ✅ CORRECT: D:\repos\project\file.tsx

This applies to:

  • Edit tool file_path parameter
  • Write tool file_path parameter
  • All file operations on Windows systems

Documentation Guidelines

NEVER create new documentation files unless explicitly requested by the user.

  • Priority: Update existing README.md files rather than creating new documentation
  • Repository cleanliness: Keep repository root clean - only README.md unless user requests otherwise
  • Style: Documentation should be concise, direct, and professional - avoid AI-generated tone
  • User preference: Only create additional .md files when user specifically asks for documentation

Bash 5.3 Features (2025)

Overview

Bash 5.3 (released July 2025) introduces significant new features that improve performance, readability, and functionality.

Key New Features

1. In-Shell Command Substitution

New: ${ command; } syntax - Executes without forking a subshell (runs in current shell context):

# OLD way (Bash < 5.3) - Creates subshell
output=$(expensive_command)

# NEW way (Bash 5.3+) - Runs in current shell, faster
output=${ expensive_command; }

Benefits:

  • No subshell overhead (faster)
  • Preserves variable scope
  • Better performance in loops

Example:

#!/usr/bin/env bash

# Traditional approach
count=0
for file in *.txt; do
    lines=$(wc -l < "$file")  # Subshell created
    ((count += lines))
done

# Bash 5.3 approach (faster)
count=0
for file in *.txt; do
    lines=${ wc -l < "$file"; }  # No subshell
    ((count += lines))
done

2. REPLY Variable Command Substitution

New: ${| command; } syntax - Stores result in REPLY variable:

# Runs command, result goes to $REPLY automatically
${| complex_calculation; }
echo "Result: $REPLY"

# Multiple operations
${|
    local_var="processing"
    echo "$local_var: $((42 * 2))"
}
echo "Got: $REPLY"

Use Cases:

  • Avoid variable naming conflicts
  • Clean syntax for temporary values
  • Standardized result variable

3. Enhanced read Builtin

New: -E option - Uses readline with programmable completion:

# Interactive input with tab completion
read -E -p "Enter filename: " filename
# User can now tab-complete file paths!

# With custom completion
read -E -p "Select environment: " env
# Enables full readline features (history, editing)

Benefits:

  • Better UX for interactive scripts
  • Built-in path completion
  • Command history support

4. Enhanced source Builtin

New: -p PATH option - Custom search path for sourcing:

# OLD way
source /opt/myapp/lib/helpers.sh

# NEW way - Search custom path
source -p /opt/myapp/lib:/usr/local/lib helpers.sh

# Respects CUSTOM_PATH instead of current directory
CUSTOM_PATH=/app/modules:/shared/lib
source -p "$CUSTOM_PATH" database.sh

Benefits:

  • Modular library organization
  • Avoid hard-coded paths
  • Environment-specific sourcing

5. Enhanced compgen Builtin

New: Variable output option - Store completions in variable:

# OLD way - Output to stdout
completions=$(compgen -f)

# NEW way - Directly to variable
compgen -v completions_var -f
# Results now in $completions_var

Benefits:

  • Cleaner completion handling
  • No extra subshells
  • Better performance

6. GLOBSORT Variable

New: Control glob sorting behavior:

# Default: alphabetical sort
echo *.txt

# Sort by modification time (newest first)
GLOBSORT="-mtime"
echo *.txt

# Sort by size
GLOBSORT="size"
echo *.txt

# Reverse alphabetical
GLOBSORT="reverse"
echo *.txt

Options:

  • name - Alphabetical (default)
  • reverse - Reverse alphabetical
  • size - By file size
  • mtime - By modification time
  • -mtime - Reverse modification time

7. BASH_TRAPSIG Variable

New: Signal number variable in traps:

#!/usr/bin/env bash
set -euo pipefail

# BASH_TRAPSIG contains the signal number being handled
handle_signal() {
    echo "Caught signal: $BASH_TRAPSIG" >&2
    case "$BASH_TRAPSIG" in
        15) echo "SIGTERM (15) received, shutting down gracefully" ;;
        2)  echo "SIGINT (2) received, cleaning up" ;;
        *)  echo "Signal $BASH_TRAPSIG received" ;;
    esac
}

trap handle_signal SIGTERM SIGINT SIGHUP

Benefits:

  • Reusable signal handlers
  • Dynamic signal-specific behavior
  • Better logging and debugging

8. Floating-Point Arithmetic

New: fltexpr loadable builtin:

# Enable floating-point support
enable -f /usr/lib/bash/fltexpr fltexpr

# Perform calculations
fltexpr result = 42.5 * 1.5
echo "$result"  # 63.75

# Complex expressions
fltexpr pi_area = 3.14159 * 5 * 5
echo "Area: $pi_area"

**U

Полный SKILL.md на GitHub

Установить bash-53-features в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл bash-53-features?

Bash 5.3 new features and modern patterns (2025). PROACTIVELY activate for: (1) Bash 5.3 specific features (BASH_TRAPSIG, in-shell command substitution, ${|} REPLY syntax), (2) checking bash version compatibility, (3) migrating scripts to take advantage of 5.3 additions, (4) C23 conformance changes in bash 5.3, (5) new shopt and bind options, (6) trap handling improvements, (7) wait -p enhancements, (8) READLINE_ARGUMENT and history expansion changes. Provides: complete 5.3 feature reference, version-detection snippets, compatibility shims for older bash, migration recipes, and POSIX.1-2024 alignment notes.

Как установить скилл bash-53-features?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл bash-53-features запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить bash-53-features с