반응형
/********************************************************************************************
-- Title : [Lnx] 파일 존재 유무 체크 쉘스크립트
-- Key word : linux centos 리눅스 shell script 쉘 스크립트 file bash 일자
********************************************************************************************/
#!/bin/sh

date  >> /home/oracle/META/df-m_date.txt
df -m >> /home/oracle/META/df-m.txt

file1="/home/oracle/META/df-m.txt"

if [ -f /home/oracle/META/df-m.txt ]; then
        echo "1.File scripted physically is exists."
fi

if [ -f $file1 ]; then
        echo "2.File scripted by variables is exists."
fi

var="Variables(`date`)"
dd=`date '+%Y%m%d %H:%M:%S'`

echo "3.AAAAA : $var"
echo "4.BBBBB : $dd"

aa="/home/oracle/META/aa.txt"
bb="/home/oracle/META/bb.txt"

if [ ! -f $aa ] && [ ! -f $bb ]; then
    echo "aa exists"
else
    echo "bb exists"
fi

반응형

+ Recent posts