1#!/bin/sh2set -e34# Host on which insomnia / hii are runnig.5HOST="someuser@example.org"67# Relative path to hii IRC directory on the host.8IDIR="irc"910target=$(ssh "${HOST}" find "${IDIR}" -maxdepth 3 -name in -a -type p | \11 awk -F / '{ printf("%s/%s\n", $2, $3) }' | fzf)1213if [ -z "${target}" ]; then14 exit 015elif [ "${target}" = "${target%%/*}" ]; then16 server="${target}"17 target=""18else19 server="${target%%/*}"20 target="${target##*/}"21fi2223exec mosh "${HOST}" -- insomnia "${server}" "${target}"