ブランチ パスを引数として、またはファイルから指定するのではなく、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
ディレクトリごとに1つのマウントコマンドを発行する必要があります。read
組み込み関数をループする。
while IFS= read -r dir; do
mount_unionfs "$dir" /photos
done <~/dirs_with_photos.txt