echo
Files
SKILL.mdagentsreferences
Install
Install only this skill with npx skills
npx skills add alisonaquinas/llm-shared-skills --skill 'echo' -g -y
Install the containing skill bundle
/plugin install shared-skills@llm-skills
This skill is bundled inside shared-skills. Use
npx skills when you only want this skill, or install the bundle once to make every included skill available through the plugin marketplace flow. Browse the full skill bundle repository at github.com/alisonaquinas/llm-shared-skills.Invoke
Invoke this skill after installation
/shared-skills:echo
SKILL.md
name: echo description: > Print text and variable values to stdout with echo or printf for shell scripting, debugging, and pipeline construction. Use when the agent needs to output a string, interpolate variables, write a line to a file, print without a trailing newline, or handle escape sequences reliably across shells and platforms.
echo
Print text to standard output in shell scripts and interactive sessions.
Prefer printf when portability and escape-sequence handling matter.
Quick Start
- Print a string:
echo "Hello, world" - Interpolate a variable:
echo "Path: $PATH" - Write to a file:
echo "content" > file.txt
Intent Router
references/cheatsheet.md— echo vs printf, common flags, escape sequences, variable interpolation, file writingreferences/advanced-usage.md— Portable printf patterns, ANSI colour output, here-strings, multiline output, and shell differencesreferences/troubleshooting.md—-eflag portability, double-vs-single quotes, newline handling, Windows CRLF
Core Workflow
- Use
echofor simple string output and variable printing in interactive sessions - Switch to
printfwhen escape sequences (\n,\t,\0), no-newline output, or cross-shell portability are required - Quote all variable expansions to prevent word-splitting:
echo "$var" - Use
>to write and>>to append to files; confirm the target path before redirecting - Prefer
printf '%s\n' "$var"overecho "$var"in scripts for consistent behaviour
Quick Command Reference
echo "Hello, world" # Print a string
echo "$HOME" # Interpolate a variable
echo -n "no newline" # Suppress trailing newline (bash built-in)
echo -e "line1\nline2" # Interpret escape sequences (bash built-in only)
echo "content" > file.txt # Write to file (overwrites)
echo "more" >> file.txt # Append to file
printf "Hello, %s\n" "$name" # Portable formatted output
printf '%s\n' "$var" # Print variable safely, no escape interpretation
printf '\033[1mBold\033[0m\n' # ANSI bold (portable colour output)
printf "line1\nline2\n" > file.txt # Multiline write (portable)
man echo # Shell built-in and /bin/echo manual
Safety Notes
| Area | Guardrail |
|---|---|
echo is not portable | The -e flag and escape interpretation differ between bash, sh, zsh, and /bin/echo. Use printf in scripts that must run across shells. |
| Unquoted variables | echo $var undergoes word-splitting and glob expansion. Always quote: echo "$var". |
| File redirection | > silently overwrites the destination. Confirm the path or use >> for appending. Enable set -o noclobber to catch accidental overwrites. |
| Secrets in arguments | Arguments to echo may appear in process listings (ps aux). Do not echo passwords or tokens in environments where process listings are visible. |
echo vs printf | In bash, echo -e works. In POSIX sh, it may not. When in doubt, use printf — it behaves consistently across all POSIX shells. |
Source Policy
- Treat
help echo(bash built-in) andman echo(external binary) as runtime truth — they may differ. - Prefer
printfoverechoin any script that will be executed byshor outside of bash. - Use
$'...'quoting in bash for literal escape sequences:echo $'line1\nline2'.
See Also
printffor portable, format-controlled output$catfor printing file contents rather than literal stringsteefor writing to both stdout and a file simultaneously