| skipped 3 lines |
4 | 4 | | |
5 | 5 | | HOST_LIST=() |
6 | 6 | | while read -r line; do |
7 | | - | HOST_LIST+=($line "") |
| 7 | + | if [[ -n "$line" ]] && [[ "$line" != "Host " ]]; then |
| 8 | + | HOST_LIST+=($line "") |
| 9 | + | fi |
8 | 10 | | done <<< $(grep -Poh "(?<=^Host\s)[\w._-]*$" ~/.ssh/config) |
| 11 | + | |
| 12 | + | if [ ${#HOST_LIST[@]} -eq 0 ]; then |
| 13 | + | echo "Error: No SSH hosts found in configuration file" |
| 14 | + | exit 1 |
| 15 | + | fi |
9 | 16 | | |
10 | 17 | | HEIGHT=20 |
11 | 18 | | WIDTH=60 |
| skipped 15 lines |