aboutsummaryrefslogblamecommitdiff
path: root/bin/shoal
blob: 9fad9454917dcfd302c279dc6301d62329c9c1e7 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                   

 

                                                                             




                                         



           
                                 
                                                                    


                                
 
#!/usr/bin/env bash

#
# shoal(1) -- Print all the non-wildcard Host names (first one per line) from
# an ssh_config(5) file, defaulting to $HOME/.ssh/config.
#
# Author: Tom Ryder <tom@sanctum.geek.nz>
# Copyright: 2014
# License: Public domain
#

# Name self
self=shoal

while read -r option value _ ; do
    if [[ $option == 'Host' && $value != *[^[:alnum:]._-]* ]] ; then
        printf '%s\n' "$value"
    fi
done < "${1:-$HOME/.ssh/config}"