# Bash CLI Framework 1 Always Use Set E

> Sub-skill of bash-cli-framework: 1. Always Use `set -e` (+4).

- Skill: `vamseeachanta/bash-cli-framework-1-always-use-set-e` (Agent Skill)
- Install (CLI): `npx skillmds@latest add vamseeachanta/bash-cli-framework-1-always-use-set-e`
- Raw SKILL.md: https://api.skillmd.com/api/skills/vamseeachanta/bash-cli-framework-1-always-use-set-e/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: vamseeachanta (https://skillmd.com/u/vamseeachanta)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/vamseeachanta/bash-cli-framework-1-always-use-set-e

---


# 1. Always Use `set -e` (+4)

## 1. Always Use `set -e`

Exit immediately if a command exits with non-zero status:
```bash
set -e
# Or for more control:
set -euo pipefail
```


## 2. Quote Variables

Always quote variables to prevent word splitting:
```bash
# Good
echo "$variable"
"$command" "$arg1" "$arg2"

# Bad
echo $variable
$command $arg1 $arg2
```


## 3. Use Meaningful Exit Codes

```bash
# Exit codes
EXIT_SUCCESS=0
EXIT_ERROR=1
EXIT_USAGE=2
EXIT_CONFIG=3
```


## 4. Provide Feedback

Always tell the user what's happening:
```bash
log_info "Starting process..."
# do work
log_info "Process complete (processed $count items)"
```


## 5. Support Dry Run

Let users preview changes:
```bash
if [[ $DRY_RUN == true ]]; then
    log_info "[DRY RUN] Would execute: $command"
else
    eval "$command"
fi
```

