develog

[bash] extract file extension 본문

카테고리 없음

[bash] extract file extension

냐옴 2022. 2. 15. 17:05

 

## 실행
$ full=/common/css/jquery.min.css; \
path=`dirname "$full"`; \
file=`basename "$full"`; \
name=${file%.*}; \
ext=${file##*.}; \
echo ''; \
echo "full =" $full; \
echo "path =" $path; \
echo "file =" $file; \
echo "name =" $name; \
echo " ext =" $ext;

## 출력
full = /common/css/jquery.min.css
path = /common/css
file = jquery.min.css
name = jquery.min
 ext = css
Comments