1# To anyone who isn't an admin, ssh motd is an unknown command: the same2# output and exit status as one that doesn't exist, nothing changed, and3# not in their help. An admin's help lists it.4. "$(dirname "$0")/../lib.sh"5user cat6user bob7repo bob/stuff8git config --file "$FORGE_ROOT/.gitconfig" forge.admins cat9# as user word args...: output and exit status, the word written WORD.10as() {11 u=$1 w=$212 shift 213 rc=014 ssh_as "$u" "$w" "$@" >"$T/out.$w" 2>&1 || rc=$?15 printf 'exit %s\n' "$rc" >>"$T/out.$w"16 sed "s/$w/WORD/g" "$T/out.$w"17}18for args in "motd" "motd hello there" "motd --clear" "motd --default"; do19 set -- $args20 shift21 eq "$(as bob motd "$@")" "$(as bob nosuch "$@")"22done23eq "$(as bob motd)" "fatal: unrecognized command 'WORD'24exit 128"25missing "$FORGE_ROOT/.forge/motd"26ok ssh_as bob help27lacks "$T_LOG" 'motd'28ok ssh_as cat help29has "$T_LOG" '^ motd \[<text>\|--clear\|--default\] '