[shell script] directory exists check


#!/bin/sh
if [ -d "$DIRECTORY" ]; then
 echo "$DIRECTORY exists." 
fi

#!/bin/sh
if [ ! -d "$DIRECTORY" ]; then
 echo "$DIRECTORY doesn't exists." 
fi

#!/bin/sh
if [ -L "$DIRECTORY" ]; then
 echo "$DIRECTORY symbolic link" 
fi 

"프로그래밍 / Linux & Shell Script" 분류의 다른 글

[shell script] bash read command (0)2014/02/11
[linux] shell command 로그 남기기 (0)2014/01/27
[linux] Linux Console에서 BEEP 사운드 끄기 (0)2014/01/27
[shell] netstat (0)2014/01/22
[shell script] 배열(Array) 사용하기 (0)2014/01/10
[shell script] 함수(Function) 사용하기 (0)2014/01/09
[linux] 메모리 (0)2013/12/17
[shell script] Here Documents (0)2013/11/26
[shell script] 실행 경로 구하기 (0)2013/10/24
[shell] yum 장애 조치 (0)2009/04/21


Powered by Textcube