#!/bin/bash # 결과를 저장할 파일명을 지정합니다. output_file="output.txt" # output.txt 파일이 이미 존재하면 삭제합니다. if [ -e "$output_file" ]; then rm "$output_file" fi # 현재 디렉토리 및 하위 디렉토리에서 모든 파일을 찾아 병합합니다. find . -type f ! -name "merge.sh" -print | while read file; do cat "$file" >> "$output_file" done # 결과를 클립보드에 복사합니다. cat "$output_file" | xclip -selection clipboard echo "머지된 파일은 $output_file 이며, 클립보드에도 복사되었습니다."