echo

echo

info
nameecho
full nameecho
aliasesecho
tagsecho

문자열을 표준 출력으로 내보내는 가장 기본적인 출력 명령이다. 대부분의 shell에서는 builtin으로 제공되며, 별도로 env echo 같은 형태로 GNU coreutils 구현을 직접 호출할 수도 있다.

  • echo [options…] STRING…
  • shell builtin이 우선 적용되는 경우가 많다.
  • escape 해석이나 이식성이 중요하면 printf가 더 예측 가능하다.
echo [OPTION]... [STRING]...
  • echo [<switches>…] message
  • echo pattern: shell이 먼저 glob을 확장한 뒤 해당 경로/파일명을 출력
  • -n: 마지막 개행 문자를 출력하지 않는다.
  • -e: backslash escape를 해석한다. 예: \n, \t, \r
  • -E: escape 해석을 비활성화한다. GNU coreutils 기본값이다.
echo hello world
echo -n "no trailing newline"
echo -e "line1\nline2"
echo *.txt
echo "$HOME"
  • echo *.txt: 현재 디렉터리의 .txt 파일명을 출력한다. 파일이 없을 때의 동작은 shell 옵션에 따라 달라진다.
  • echo "$HOME": 변수 확장 결과를 출력한다.
echo는 shell builtin과 외부 명령(GNU coreutils) 사이에 동작 차이가 있을 수 있다. 옵션 처리와 escape 해석이 중요하면 printf를 우선 검토한다.
  • command -V echo로 현재 shell에서 builtin인지 확인할 수 있다.
  • Bash에서는 보통 builtin `echo`가 먼저 실행된다.
  • env echo –help처럼 호출하면 외부 `echo` 구현의 도움말을 직접 볼 수 있다.
  • POSIX 환경에서는 -n과 escape 해석 동작이 shell마다 다를 수 있다.
  • GNU coreutils `echo`는 –help, –version, -E를 지원한다.
  • portable script에서는 echo -e 대신 printf가 더 안전하다.

env echo --help

  • codex:: 2026-06-20 Reorganized echo into the standard CLI reference structure with builtin/coreutils notes, options, examples, and help output.
  • /home/u613600155/domains/cli.zerotymer.net/public_html/data/pages/echo.txt
  • 마지막으로 수정됨: 2026/06/20 10:47
  • 저자 127.0.0.1