diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-07-31 11:53:31 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-07-31 11:54:55 +1200 |
commit | 17f6305e253cc36acec5384c55d8369405645a03 (patch) | |
tree | 12aff25cfd17fa3deabbab1b8b42fb46a090f96c /bin | |
parent | Remove poetry games tinkering scripts (diff) | |
download | dotfiles-17f6305e253cc36acec5384c55d8369405645a03.tar.gz dotfiles-17f6305e253cc36acec5384c55d8369405645a03.zip |
Split out sls(1) into shell and awk
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/sls | 26 | ||||
-rwxr-xr-x | bin/slsf | 9 |
2 files changed, 17 insertions, 18 deletions
@@ -1,18 +1,8 @@ -#!/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 } +#!/bin/sh +if [ "$#" -eq 0 ] ; then + for cfg in /etc/ssh_config "$HOME"/.ssh/config ; do + [ -e "$cfg" ] || continue + set -- "$@" "$cfg" + done +fi +exec slsf -- "$@" diff --git a/bin/slsf b/bin/slsf new file mode 100755 index 00000000..72af8691 --- /dev/null +++ b/bin/slsf @@ -0,0 +1,9 @@ +#!/usr/bin/awk -f + +# Manage the processing flag (starts set in each file) +FNR == 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 } |