Projects STRLCPY nssh Commits 2564601f
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■ ■
    nssh
     1 +#!/bin/bash
     2 + 
     3 +trap "clear" EXIT
     4 + 
     5 +HOST_LIST=()
     6 +while read -r line; do
     7 + HOST_LIST+=($line "")
     8 +done <<< $(grep -Poh "(?<=^Host\s)[\w._-]*$" ~/.ssh/config)
     9 + 
     10 +HEIGHT=30
     11 +WIDTH=60
     12 +BACKTITLE="Select you SSH connection"
     13 +TITLE="SSH Servers"
     14 +MENU="Choose one of the following servers:"
     15 + 
     16 +CHOICE=$(dialog --clear \
     17 + --backtitle "$BACKTITLE" \
     18 + --title "$TITLE" \
     19 + --menu "$MENU" \
     20 + $HEIGHT $WIDTH $HEIGHT \
     21 + "${HOST_LIST[@]}" \
     22 + 2>&1 >/dev/tty)
     23 +clear
     24 + 
     25 +ssh $CHOICE
     26 + 
Please wait...
Page is in error, reload to recover