#!/bin/bash

clear && printf '\e[3J'

# 현재 디렉토리에서 가장 최근에 생성된 파일 찾기
# (디렉토리 제외, 숨김 파일 포함)

latest_file=$(find . -maxdepth 1 -type f -printf '%T@ %p\n' 2>/dev/null | sort -n | tail -1 | cut -d' ' -f2-)

# 파일이 없는 경우
if [ -z "$latest_file" ]; then
    echo "현재 폴더에 파일이 없습니다."
    exit 1
fi

# 파일명과 내용 출력
echo "파일명: ${latest_file#./}"
echo "내용: "
cat "$latest_file"
