Avoid common Bash mistakes — quoting traps, word splitting, and subshell gotchas.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install bash或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install bash⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/bash/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: Bash slug: bash version: 1.0.2 description: Write reliable Bash scripts with proper quoting, error handling, and parameter expansion. metadata: {"clawdbot":{"emoji":"🖥️","requires":{"bins":["bash"]},"os":["linux","darwin"]}} ---
| Topic | File | |-------|------| | Arrays and loops | arrays.md | | Parameter expansion | expansion.md | | Error handling patterns | errors.md | | Testing and conditionals | testing.md |
"$var" not $var, spaces break unquoted"${arr[@]}" preserves elements—${arr[*]} joins into single string'$var' doesn't expand"$(command)" not $(command)$var splits on whitespace—file="my file.txt"; cat $file fails expands to files—quote or escape if literal: "" or \*set -f disables globbing—or quote everything properly[[ ]] preferred over [ ]—no word splitting, supports &&, ||, regex[[ $var == pattern* ]]—glob patterns without quotes on right side[[ $var =~ regex ]]—regex match, don't quote the regex-z is empty, -n is non-empty—[[ -z "$var" ]] tests if emptycat file | while read; do ((count++)); done—count lostwhile read < file or process substitution—while read; do ...; done < <(command)( ) is subshell, { } is same shell—variables in ( ) don't persistset -e exits on error—but not in if, ||, && conditionsset -u errors on undefined vars—catches typosset -o pipefail—pipeline fails if any command fails, not just lasttrap cleanup EXIT—runs on any exit, even errorsarr=(one two three)—or arr=() then arr+=(item)${#arr[@]}—not ${#arr}"${arr[@]}"—always quote${!arr[@]}—useful for sparse arrays${var:-default}—use default if unset/empty${var:=default}—also assigns to var${var:?error message}—exits with message${var:0:5}—first 5 chars${var#pattern}—## for greedy$(( )) for math—result=$((a + b))(( )) for conditions—if (( count > 5 )); then$ needed inside $(( ))—$((count + 1)) not $(($count + 1))[ $var = "value" ] fails if var empty—use [ "$var" = "value" ] or [[ ]]if [ -f $file ] with spaces—always quote: if [[ -f "$file" ]]local in functions—without it, variables are globalread without -r—backslashes interpreted as escapesecho portability—use printf for reliable formatting安装 Bash 后,可以对 AI 说这些话来触发它
Help me get started with Bash
Explains what Bash does, walks through the setup, and runs a quick demo based on your current project
Use Bash to avoid common Bash mistakes — quoting traps, word splitting, and sub...
Invokes Bash with the right parameters and returns the result directly in the conversation
What can I do with Bash in my developer & devops workflow?
Lists the top use cases for Bash, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/bash/ 目录(个人级,所有项目可用),或 .claude/skills/bash/(项目级)。重启 AI 客户端后,用 /bash 主动调用,或让 AI 根据上下文自动发现并使用。
Bash 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Bash 可免费安装使用。请查阅仓库了解许可证信息。
Avoid common Bash mistakes — quoting traps, word splitting, and subshell gotchas.
Bash 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my developer & devops tasks using Bash
Identifies repetitive steps in your workflow and sets up Bash to handle them automatically