aboutsummaryrefslogtreecommitdiff
path: root/bin/sls
blob: 278d79b410790832a210f4cea09874388ffbd5f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/awk -f

# If no arguments, assume the default config files
BEGIN {
    if (ARGC == 1) {
        ARGV[1] = "/etc/ssh/ssh_config"
        ARGV[2] = ENVIRON["HOME"] "/.ssh/config"
        ARGC += 2
    }
}

# Manage the processing flag (starts set)
NR == 1 || /### sls/ { sls = 1 }
/### nosls/ { sls = 0 }

# If processing flag set, directive is "Host", and hostname has no wildcards,
# then print it
sls && $1 == "Host" && $2 !~ /\*/ { print $2 }