$
학습 Linux 안내서
ko
XP:0
퀘스트 22Expansionist
+220 XP

Brace Expansion & Safe Directory Removal ({} & rmdir)

이 퀘스트를 위한 인터랙티브 터미널 시작→설치 불필요 • 브라우저에서 바로 실행

개념 및 개요

Bash brace expansion {} is a powerful productivity feature that generates arbitrary string combinations before commands run, eliminating repetitive typing:

- Comma-separated lists: mkdir -p app/{src,bin,logs} expands to app/src, app/bin, and app/logs in a single command.
- Numeric or alphabetic ranges: touch file_{1..3}.txt expands to file_1.txt, file_2.txt, and file_3.txt.

When deleting folders, rm -r deletes everything recursively without safety checks. By contrast, rmdir provides a strict safety guarantee: it only removes directories that are completely empty, preventing accidental loss of files.

Practice brace expansion and safe directory removal!
1. Run mkdir -p app/{src,bin,logs} to build multiple application directories at once.
2. Run touch file_{1..3}.txt to create three numbered files in one command.
3. Safely delete the empty folder temp_empty using rmdir temp_empty.

명령어 구문 참조

Command / SyntaxDescription
mkdir -p app/{src,bin,logs}Create multiple directories using brace expansion
touch file_{1..3}.txtCreate sequential files using range expansion
rmdir temp_emptySafely remove an empty directory

검증 목표

  • ○
    Create directories app/src, app/bin, and app/logs using brace expansion
  • ○
    Create file_1.txt, file_2.txt, and file_3.txt using brace expansion
  • ○
    Safely remove directory temp_empty using rmdir

퀘스트를 완료할 준비가 되셨나요? 22?