zsh-gotchas
БесплатноБез исполняемых скриптовНе проверенZsh expansions that rewrite a command: $VAR:word, leading =, no word splitting, `path` tied to PATH, bare `local`. Use when a zsh command gives a wrong…
от laurigates★ 61 звезда на GitHubОб этом скилле
Zsh Gotchas — Five Expansions That Rewrite Your Command
Five zsh behaviours. The first four have no bash equivalent; the fifth is
shared with bash for typeset, declare and export, and is zsh's own for
local. Each one fires on ordinary commands, including the one-liners an
agent runs through the Bash tool — not just on .zsh files — so a snippet
lifted from a bash-tested doc breaks only here.
What makes them expensive is that three of the five fail silently or misattribute: the command runs, exits, and reports something that looks like a real answer about the world. The fifth is loud, and what it prints is the environment. The first four were each diagnosed the wrong way first.
| Symptom | Mechanism | Section |
|---|---|---|
A URL/path with $var: hits the wrong endpoint; fast empty 404 |
$VAR:x is a history modifier |
1 |
A later command in a ; chain produced no output |
a word starting with = is a command lookup |
2 |
$2 empty after set -- $spec; tool prints its usage text |
zsh does not word-split | 3 |
command not found for a tool that is installed |
path is tied to PATH |
4 |
A function prints hundreds of NAME=value lines before its real output |
local $names with names empty is a bare local |
5 |
Out of scope: zsh-vs-POSIX pattern expansion and extended glob. Those bite when
writing .zsh / zshrc files, not on every command, and are not covered here.
When to Use This Skill
| Use this skill when... | Use shell-expert instead when... |
|---|---|
| A zsh command ran and returned a result that does not match what you typed | Writing a shell script, function, or pipeline from scratch |
| An unexpected 404, an empty positional, or a missing chunk of output from a chain | Choosing portable constructs across bash / zsh / POSIX |
command not found names a tool you know is installed |
Structuring error handling, set flags, or CLI argument parsing |
| A bash-tested snippet behaves differently once run through the Bash tool | The question is shell style rather than a wrong runtime result |
The split is runtime versus authoring: this skill covers five expansions that make a correct-looking zsh command do something else, three of them silently.
1. $VAR:word Is a Modifier, Not a Colon After a Variable
Zsh applies history-style modifiers directly to a bare parameter expansion:
$f:h (dirname), $f:t (basename), $f:r, $f:e, $f:s/a/b/, $f:g…. So a
URL that puts a variable straight before a colon is not the URL you wrote:
# Wrong — `:g` is read as the start of a global-substitution modifier
curl "https://…/v1beta/models/$MODEL:generateContent"
Observed 2026-09-05 (robocar-unified, probing a replacement Gemini model): three
requests came back HTTP 404 in 60 ms with an empty body, and were nearly
reported as "the new model does not support generateContent". The empty body and
the sub-100 ms turnaround were the tell — a real API 404 carries a JSON error and
takes a round trip. The same request with braces returned 200.
The fix
Brace the expansion. Braces end the parameter name, so the colon is literal:
curl "https://…/v1beta/models/${MODEL}:generateContent"
Double quotes do not protect you — modifiers apply inside them.
When it bites
- Gemini-style
model:methodREST paths,host:port,user:group,file:line,scp/rsynchost:pathtargets — any$var:with a letter after the colon. - A modifier letter that zsh does not recognise errors loudly
(
unrecognized modifier); the recognised ones (g,h,t,r,e,s,a,A,l,u,q,Q,x,c,P) fail silently by rewriting the string.
2. A Word Starting With = Is a Command Lookup
With EQUALS set (the zsh default), an unquoted word that begins with = is
replaced by the path of the command named after it: =ls becomes /bin/ls.
When no such command exists, the expansion is a fatal error that aborts the
rest of the command line, not just that word, and ; does not contain it:
zsh -fc 'echo a; echo ======; echo b'
# a
# zsh:1: ===== not found ← `echo b` never runs, exit 1
Observed 2026-09-15 (claude-plugins, session-end): survey.sh …; echo ======; distill-survey.sh … printed the survey, then (eval):1: ===== not found, and
the second collector silently never ran. The error names the word minus its
leading =, which reads like a missing command rather than a separator.
The fix
Quote the word (echo '======'), or use a separator that does not start with
= (echo ---). setopt noequals also works but changes the shell for
everything after it.
When it bites
- Section separators in chained d
Установить zsh-gotchas в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadFAQ
Что делает скилл zsh-gotchas?
Zsh expansions that rewrite a command: $VAR:word, leading =, no word splitting, `path` tied to PATH, bare `local`. Use when a zsh command gives a wrong result, dumps variables or a tool seems missing.
Как установить скилл zsh-gotchas?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл zsh-gotchas запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic