shell-port
Procedure for porting a shell script to a target matrix: bash 3.2 through 5.3 (the macOS system bash), or POSIX sh on dash, busybox ash and bash --posix. Runs…
от ocx-sh★ 20 звёзд на GitHub
Установить shell-port в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
shell-port
A shell script has to run somewhere it does not run today: the macOS system
bash (3.2.57), an Alpine or Debian /bin/sh, or every bash from 3.2 to 5.3.
This skill carries the procedure only. The standards live in the
shell-quality rule, and this skill cites them by ID. It reads dialect.md
(SH-DIAL) and userland.md (SH-USER) from the shell-quality-reference skill.
Every command and every form was run on bash 3.2.57 to 5.3, dash 0.5.12-2,
busybox ash 1.37 and ShellCheck 0.11.0 on 2026-10-11 (measured 2026-10-11).
macOS itself, Apple's build of bash and BSD userland are unverified: read only, and the receipt says so. The bash images carry Alpine userland, so a
port that touches date, sed or readlink also needs the SH-USER pass of
step 6. A script that must also run under Git Bash or PowerShell needs the
Windows runs the shell-quality CI family describes. This skill does not cover
them.
The whole procedure was replayed on 2026-10-11 on a script from a third-party tree
(the ble.sh string-split-lines.sh benchmark, behind a stub): the baseline read
distinct: 2 of 8 legs with mapfile: command not found on bash 3.2 only, the
replacement form of step 4 gave distinct: 1 of 8 legs and oracle: match.
Contents: Step 1: floor and target · Step 2: baseline · Step 3: static pass · Step 4: fix by class · Step 5: acceptance run · Step 6: second static pass · Pin instead · Stop condition · Never edit the check · The receipt · Rules carried · MUST rows · Other findings · What agents get wrong
| Read | When |
|---|---|
| references/port-legs.sh | Steps 2 and 5, and the pin check: runs the script on every leg of the matrix and counts distinct results |
| references/replacements.md | Step 4: the 3.2 form of each bash 4 and 5 construct, the POSIX form of each bashism, and the text 3.2 prints for each |
Before you start
The matrix runs the script inside throwaway containers with its directory
mounted read-only. It needs Docker and pulls bash:3.2 to bash:5.3,
debian:12 and alpine:3.22 the first time. Without Docker, say so and stop:
a green ShellCheck is not a substitute (SH-CORE-08), and a bash 5 run on the
author's machine proves nothing about 3.2.
Run only the script's no-side-effect path (--help, a dry-run flag, a fixed
fixture directory). A script that deletes, pushes or installs gets a driver
that calls its functions on a scratch tree. The matrix sees only the path that
executes, which is why step 3 exists.
The output must be deterministic. A clock, a PID or a temp name in the output makes every leg differ. Fix the arguments or wrap the script in a driver that prints deterministic facts, and run that driver on every leg. Never filter the difference away after the fact.
Step 1: read the floor and choose the target
Read the header before editing (SH-CORE-04). The shebang, # Kind: and
# bash-floor: sit in lines 1 to 8 (SH-DIAL-01, SH-DIAL-03).
# rename SCRIPT to the operator-named script, LEGS to this skill's references/ copy
SCRIPT=scripts/announce.sh
LEGS=.claude/skills/shell-port/references/port-legs.sh
ls -- "$LEGS"
head -n 8 -- "$SCRIPT"
| Header says | Target | Matrix family |
|---|---|---|
#!/usr/bin/env bash and no bash-floor |
bash 3.2.57, the unpinned floor (SH-DIAL-06) | bash: 3.2, 4.0, 4.2, 4.4, 5.0 to 5.3 |
#!/bin/sh, or Kind: installer, RC or sh library |
POSIX.1-2017 plus probes (SH-DIAL-04) | sh: dash, busybox ash, bash 3.2 --posix, and bash 5.3 as the oracle |
# bash-floor: X.Y |
the named floor | read Pin instead |
| no header | the kind is a decision. Write the header first | ask which shells will run it |
No header means the floor is undeclared. Write # Kind: and the floor line
before the first fix (SH-DIAL-03) and report that the file lacked it.
Port or pin (SH-CORE-09). Port when the script is reachable from macOS, a
macos-* runner, a Taskfile or a workflow step. Pin when it is not: the file
runs only in an image that ships bash 5, and porting costs readability for no
reader. Say which in the receipt and why. When in doubt, ask who runs it.
Step 2: baseline before any edit
The baseline is the red. Run it before touching the file and paste it (SH-CORE-08, SH-CORE-02).
ORACLE=$(mktemp "${TMPDIR:-/tmp}/oracle.XXXXXX")
PORT_SAVE="$ORACLE" sh "$LEGS" bash "$SCRIPT"
For an sh target, replace bash with sh. The script prints one block per
leg and ends with distinct: N of M legs. Exit 1 here is the red and no
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/port-legs.sh
- references/replacements.md
FAQ
Что делает скилл shell-port?
Procedure for porting a shell script to a target matrix: bash 3.2 through 5.3 (the macOS system bash), or POSIX sh on dash, busybox ash and bash --posix. Runs a baseline on every leg, the bash 4 denylist, fixes by class, reruns until the output is byte-identical, and ends in a receipt, or pins the floor with a guard instead. Use when someone says "make this work on macOS", "port this script to bash 3.2", "works on Linux but not on my Mac", "bad substitution", "declare: -A: invalid option", "mapfile: command not found", "unbound variable" on an empty array, "needs bash 4", "support the system bash", "make this POSIX sh", "run on Alpine", "run on busybox", "run on dash", "convert this bash script to sh", or "Illegal option -o pipefail". Not for a failure whose cause is unknown (shell-diagnose), shell generated for other shells (shell-integration), an install.sh and install.ps1 pair (installer-script), or PowerShell.
Как установить скилл shell-port?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл shell-port запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…