OS/Linux
bash {} expansion
뭉기
2020. 3. 28. 20:09
❯ echo filepath.ext{,.bak}
filepath.ext filepath.ext.bak
❯ echo filepath{.ext,.bak.ext}
filepath.ext filepath.bak.ext
❯ FILENAME=myfile.ext
❯ FILE=${FILENAME%.*}
❯ EXTN=${FILENAME##*.}
❯ echo $FILE $EXTN
myfile ext
❯ echo $FILE.{$EXTN,bak.$EXTN}
myfile.ext myfile.bak.ext