Linux/Unix Power Tools 리눅스 커맨드 라인(linux command line) 명령어 사용법 Current: Linux 파일 이름에서 경로와 확장자를 추출하는 법(Extract File Basename Without Path and Extension in Bash) Linux 파일 이름에서 경로와 확장자를 추출하는 법(Extract File Basename Without Path and Extension in Bash) 개요bash shell script 에서 file path 에서 확장자나 Path 를 제거하고 파일명만 뽑아내는 방법(bash shell 에서만 동작함)Path 제거하고 file 명만 추출 $ s=/the/path/foo.txt $ echo ${s##*/} foo.txt BASH 파일명에서 확장자 제거(확장자가 .txt 에만 동작함. "basename foo.txt .txt" 와 동일) $ s=foo.txt $ echo ${s%.txt} foo BASH . 뒤에 붙은 임의의 확장자 제거 $ s=foo.txt $ echo ${s%.*} foo BASH 같이 보기리눅스 basename, dirname 으로 경로와 파일 이름 추출하기Refhttp://stackoverflow.com/questions/2664740/extract-file-basename-without-path-and-extension-in-bashhttp://www.thegeekstuff.com/2010/07/bash-string-manipulation/http://www.debuntu.org/how-to-bash-parameter-expansion-and-string-manipulation/ bash ×