관리 메뉴

Sysops Notepad

[bash] 쉘 스크립트 디렉토리 or 파일 존재 여부 확인하는 법 본문

업무/dev

[bash] 쉘 스크립트 디렉토리 or 파일 존재 여부 확인하는 법

sysops 2018. 10. 31. 20:36


linux bash shell script  directory , file check 하는 방법


#!/bin/bash

# 디렉토리 존재 유무 확인
If [ ! -d 디렉토리명 ] ; then
 mkdir 디렉토리명
fI


# 파일 존재 유무 확인
If [ ! -e 디렉토리명 ] ; then
 touch 파일명
fI



Comments