Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Bash

ASecurity

Bash 5.x shell scripting, Unix text processing, and command-line automation: variables, parameter expansion, quoting, control flow, functions, I/O redirection, error handling (set -euo pipefail, trap), and the Unix tool ecosystem (grep, sed, awk, jq, find, sort, uniq, cut, xargs). Covers process management, networking (curl, ssh, rsync, nc), file locking (flock), parallel execution, and production script patterns. WHEN: \"Bash\", \"bash\", \"shell\", \"sh\", \".sh\", \"shell script\", \"sed\"...

4 stars
0 votes
0 copies
0 views
Added 9/24/2026
toolsgoshellbashapi

Works with

cliapi

Security Analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned 9/24/2026

$npx -y skills add chrishuffman5/domain-expert --skill bash --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Bash?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Bash
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/chrishuffman5-bash/badge)](https://www.skillsdirectory.com/skills/chrishuffman5-bash)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: bash
description: "Bash 5.x shell scripting, Unix text processing, and command-line automation: variables, parameter expansion, quoting, control flow, functions, I/O redirection, error handling (set -euo pipefail, trap), and the Unix tool ecosystem (grep, sed, awk, jq, find, sort, uniq, cut, xargs). Covers process management, networking (curl, ssh, rsync, nc), file locking (flock), parallel execution, and production script patterns. WHEN: \"Bash\", \"bash\", \"shell\", \"sh\", \".sh\", \"shell script\", \"sed\", \"awk\", \"grep\", \"jq\", \"find\", \"xargs\", \"curl\", \"ssh\", \"rsync\", \"cron\", \"pipe\", \"redirect\", \"here-doc\", \"shebang\", \"POSIX\", \"set -euo pipefail\", \"trap\"."
license: MIT
---

# Bash Technology Expert

This skill covers Bash 5.x scripting and the Unix command-line tool ecosystem. Read it for:

- Variables: quoting rules, parameter expansion, arithmetic, arrays (indexed + associative)
- Control flow: `[[ ]]` tests, case/esac, for/while/until, select menus
- Functions: local scope, return codes, output capture, namerefs (`declare -n`)
- I/O: file descriptors, redirection (`>`, `2>`, `&>`), here-docs, here-strings, process substitution (`<()`, `>()`)
- Strings: substring extraction, case conversion, regex matching (`=~`, `BASH_REMATCH`), printf formatting
- Error handling: `set -euo pipefail`, trap (EXIT, ERR, INT, TERM), die pattern, retry with backoff
- Text processing: grep (basic/extended/PCRE), sed (substitution, ranges, in-place), awk (fields, arrays, aggregation), jq (JSON)
- File tools: find (by name/size/time/permissions, -exec), sort, uniq, cut, paste, comm, diff, head, tail
- Process management: ps, jobs, signals (kill, trap), nohup, disown, timeout, wait
- Networking: curl (REST, auth, retry, timing), ssh (tunnels, config, jump hosts), scp, rsync, nc
- Script patterns: argument parsing (getopts, manual), logging with colors, file locking (flock), parallel execution (xargs -P, GNU parallel)

## How to Approach Tasks

1. **Classify** the request:
   - **Language/syntax** -- Load `references/language.md`
   - **Tools** -- Load `references/tools.md`
   - **Script patterns** -- Load `references/patterns.md`

2. **Apply Bash idioms** -- Use built-in features over external commands when possible. Use `[[ ]]` not `[ ]`. Quote all variables. Prefer `$(command)` over backticks. Use arrays for lists of items.

3. **Always start scripts with:**
   ```bash
   #!/usr/bin/env bash
   set -euo pipefail
   ```

4. **Recommend** -- Provide complete, tested code. Always include error handling and cleanup traps.

## Core Expertise Overview

### Variables and Parameter Expansion

```bash
name="Alice"
echo "${name:-default}"        # use default if unset/empty
echo "${path##*/}"             # basename (remove longest prefix)
echo "${path%/*}"              # dirname (remove shortest suffix)
echo "${var/old/new}"          # replace first match
echo "${var//old/new}"         # replace all
echo "${var^^}"                # uppercase
echo "${var,,}"                # lowercase
echo "${#var}"                 # string length
echo "${var:0:5}"              # substring
```

### Arrays

```bash
arr=(alpha beta gamma)
echo "${arr[0]}"               # first element
echo "${arr[@]}"               # all elements
echo "${#arr[@]}"              # count
for item in "${arr[@]}"; do echo "$item"; done

declare -A config              # associative array
config[host]="localhost"
config[port]="5432"
```

### Error Handling

```bash
set -euo pipefail              # exit on error, unset vars, pipe failures
trap 'cleanup' EXIT            # always cleanup
trap 'echo "Error at line $LINENO"; exit 1' ERR
```

### Text Processing Pipeline

```bash
# Count errors per IP from access log
grep "ERROR" access.log |
    grep -oE '\b([0-9]{1,3}\.){3}[0-9]{1,3}\b' |
    sort | uniq -c | sort -rn | head -10
```

### JSON Processing with jq

```bash
# Extract, filter, transform
curl -s "$API_URL" | jq '[.[] | select(.status == "active") | {name, id}]'
```

## Common Pitfalls

**1. Unquoted variables**
`$var` undergoes word splitting and glob expansion. Always use `"$var"`, especially in `if` conditions and `for` loops.

**2. Using `[ ]` instead of `[[ ]]`**
`[[ ]]` is a Bash built-in with better syntax (supports `&&`, `||`, `=~`). `[ ]` is POSIX but requires careful quoting.

**3. Losing variables in pipe subshells**
`echo | while read line; do count=$((count+1)); done` -- `count` is lost because `while` runs in a subshell. Use `while ... done < <(command)` instead.

**4. Not using `set -euo pipefail`**
Without it, errors are silently ignored. The script continues after failed commands.

**5. Using `echo` for formatted output**
`echo -e` behavior varies across systems. Use `printf` for portable formatted output.

**6. Parsing `ls` output**
`ls` output is not machine-parseable (spaces in filenames, locale-dependent formatting). Use `find` or glob patterns instead.

**7. Not handling filenames with spaces/newlines**
Always use `find -print0 | xargs -0` for safe filename handling.

**8. Missing `|| true` after optional commands with `set -e`**
With `set -e`, any command that fails exits the script. Use `command || true` for commands allowed to fail.

## Reference Files

Load these for deep knowledge:

- `references/language.md` -- Variables, parameter expansion, quoting, control flow, functions, I/O redirection, strings, error handling. Read for syntax questions.
- `references/tools.md` -- grep, sed, awk, jq, find, sort, uniq, cut, process management, networking (curl, ssh, rsync). Read for tool usage questions.
- `references/patterns.md` -- Script template, argument parsing (getopts + manual), logging with colors, file locking (flock), parallel execution. Read for script structure questions.

## Example Scripts

- `scripts/01-system-report.sh` -- System health report with color output
- `scripts/02-log-analyzer.sh` -- Log parsing with grep/awk/sed
- `scripts/03-backup-rotate.sh` -- Backup with rotation and retention
- `scripts/04-api-client.sh` -- curl-based REST API client

Attribution

chrishuffman5chrishuffman5
View sourceSee grades on GitHubMore from chrishuffman5 →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

ucoz-landing-skill

Create and edit uCoz homepage landing pages via MCP: custom templates, hero sections, lead forms, navigation menus, SEO, and responsive layout. Includes a visual design system (style selection, layout/grid, section recipes, typography/spacing, color tokens, component states, icons, modern CSS/JS, motion, imagery, social proof, copy/voice, accessibility). Uses ucoz-mcp tools for templates, site file uploads, and site modules.

107 votes

Paperclip

Interact with the Paperclip control plane API for task coordination and governance. Use when checking assignments, updating issue status, posting comments, delegating work, managing routines, or calling Paperclip API endpoints.

953191 votes

Pptx

Presentation toolkit (.pptx). Create/edit slides, layouts, content, speaker notes, comments, for programmatic presentation creation and modification.

471861 votes

Daw Music

Digital Audio Workstation usage, music composition, interactive music systems, and game audio implementation for immersive soundscapes.

761 votes

Instantly Rdsthomas Mission Control

Instantly.ai cold email outreach API - manage campaigns, leads, accounts, and analytics. Use for cold email automation, lead management, campaign creation/monitoring, and email account warmup.

761 votes
View all in tools →