#!/bin/bash cd "${0%/*}/.." rm -rf --one-file-system out mkdir out for host in hosts/*; do [ "${host#*/}" = 'all' ] && continue cat "${host}" "hosts/${host#*@}" 'hosts/all' \ 2>/dev/null \ | sed ' s@^@pubkeys/@ s@$@.pub@ ' \ | xargs -r cat >"out/${host}.authorized_keys" done