1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-03-28 21:16:20 +01:00
tldr/pages.ko/common/printf.md
K.B.Dharun Krishna 898f711019
pages/*: update GNU coreutils links, sync translation pages (#15543)
Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
2025-01-18 18:45:33 +05:30

801 B

printf

텍스트를 형식화하여 출력. 더 많은 정보: https://www.gnu.org/software/coreutils/manual/html_node/printf-invocation.html.

  • 텍스트 메시지 출력:

printf "{{%s\n}}" "{{Hello world}}"

  • 정수를 굵은 파란색으로 출력:

printf "{{\e[1;34m%.3d\e[0m\n}}" {{42}}

  • 유로 기호와 함께 실수 출력:

printf "{{\u20AC %.2f\n}}" {{123.4}}

  • 환경 변수를 사용하여 구성된 텍스트 메시지 출력:

printf "{{var1: %s\tvar2: %s\n}}" "{{$VAR1}}" "{{$VAR2}}"

  • 형식화된 메시지를 변수에 저장 (Zsh에서는 작동하지 않음):

printf -v {{myvar}} {{"This is %s = %d\n" "a year" 2016}}

  • 16진수, 8진수 및 과학적 표기법 숫자 출력:

printf "{{hex=%x octal=%o scientific=%e}}" 0x{{FF}} 0{{377}} {{100000}}