function zssh_generate_config4 { ssh_node="$1" dst="$zssh_private_configs/$ssh_node.sshconf" srcs="$zssh_global_configs/$ssh_node" zshlibs_log zssh_client "checking configs for $ssh_node …" if ! [[ -d "$srcs" ]] then zshlibs_log zssh_client "$ssh_node does not have config" elif ! [[ $dst -nt $srcs ]] then sshkey="$zssh_private_keys/$ssh_node.key" zshlibs_log zssh_client "generating '$dst' with key '$sshkey'" matched=1 rm "$dst" 2> /dev/null for src in "$srcs"/*.sshconf(N) do matched=0 zshlibs_log zssh_client "sourcing $src" cat "$src" >> "$dst" printf "\n IdentityFile %s\n\n" "$sshkey" >> "$dst" done if ! [[ $matched ]] then zshlibs_log zssh_client "no configs for '$dst'" fi fi zshlibs_log zssh_client "done with $ssh_node" }