
디렉터리 판단:
path="/home"
#if [ ! -d ${path} ];then
if [ -d ${path} ];then
echo dir ${path} exist!
else
echo dir ${path} not exist!
fi무료 학습 영상 튜토리얼 공유: linux 영상 튜토리얼
파일 판단:
file="/home/log.txt"
if [ -f ${file} ];then
echo file ${file} exist!
else
echo file ${file} not exist!
fi관련 글 튜토리얼 추천: linux tutorial
위 내용은 Linux에서 if 문을 통해 파일이나 디렉터리가 존재하는지 확인하는 방법의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!