%20%EB%B8%8C%EB%9E%9C%EC%B9%98%EB%A5%BC%20%EB%A7%88%EC%9A%B4%ED%8A%B8%ED%95%98%EC%8B%9C%EA%B2%A0%EC%8A%B5%EB%8B%88%EA%B9%8C%3F.png)
인수나 파일에서 분기 경로를 제공하는 대신 stdin에서 mount(또는 mount_unionfs) 명령으로 분기 경로를 제공할 수 있습니까?
cat ~/dirs_with_photos.txt | mount -t unionfs
/etc/fstab
이상적으로는 cron 작업을 사용하여 이러한 txt 파일을 동적으로 자동 생성하고 싶기 때문에 사용하고 싶지 않습니다 .
@weekly find $HOME -type d -iname "*photos*" > ~/dirs_with_photos.txt
답변1
입력을 필요한 구문으로 변환하고 명령줄에 연결합니다.명령 대체.
dirs_with_photos="$(<~/dirs_with_photos.txt tr '\n' :)"
if [ -n "$dirs_with_photos" ]; then
unionfs-fuse "${dirs_with_photos%:}" /photos
fi
그리고mount_unionfs
각 디렉터리에 대해 탑재 명령을 실행해야 합니다. 당신은 그것을 사용할 수 있습니다read
내장 루프 주변.
while IFS= read -r dir; do
mount_unionfs "$dir" /photos
done <~/dirs_with_photos.txt