#!/bin/bash montami() { B=$(basename $1) mount "/srv/pxe/iso/$B" "/srv/pxe/mount/$B" echo "mounted '/srv/pxe/iso/$B' on '/srv/pxe/mount/$B'" } export -f montami find /srv/pxe/mount/ -mindepth 1 -maxdepth 1 -type d -exec bash -c 'montami "$0"' {} \;