Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Path 제거하고 file 명만 추출
    Code Block
    languagebash
    $ s=/the/path/foo.txt
    $ echo ${s##*/}
    foo.txt
  2. 파일명에서 확장자 제거(확장자가 .txt 에만 동작함. "basename foo.txt .txt" 와 동일)

    Code Block
    languagebash
    $ s=foo.txt
    $ echo ${s%.txt}
    foo
  3. . 뒤에 붙은 임의의 확장자 제거

    Code Block
    languagebash
    $ s=foo.txt
    $ echo ${s%.*}
    foo

같이 보기


Ref