
만약 내가 가지고 있다면
/mydir/myfile.txt
이 코드는 에코됩니다.file already exists
if [ ! -f "/mydir/myfile.txt" ]; then
touch "/mydir/myfile.txt"
echo "created file"
else
echo "file already exists"
fi
하지만 내가 가지고 있다면
/mysecondarydir/myfile.txt
그런 다음
ln -s /mysecondarydir /mydir
따라서 이것은 /mydir
위의 코드가 에코하는 것처럼 일반 디렉토리가 아닌 심볼릭 링크입니다 created file
.
두 경우 모두 같은 방식으로 처리되기를 바랍니다. 어떻게 해야 하나요?