Tools/Linux 관리
[리눅스][bash] directory 존재 유무 검사 및 action 수행
B&U
2016. 4. 29. 01:04
bash 에서 directory 존재 여부를 검사하여 만약 존재하는 폴더를 삭제하는 방법입니다
1. 간단한 방법
`[ -d test ] && rm -r test`
2. 조금은 길지만 이해는 쉬운 방법
if [ -d directory/path to a directory ] ; then
FILE_EXISTED = `rm -r test`
fi