aboutsummaryrefslogtreecommitdiff
path: root/bin/slsf
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-07-31 11:53:31 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-07-31 11:54:55 +1200
commit17f6305e253cc36acec5384c55d8369405645a03 (patch)
tree12aff25cfd17fa3deabbab1b8b42fb46a090f96c /bin/slsf
parentRemove poetry games tinkering scripts (diff)
downloaddotfiles-17f6305e253cc36acec5384c55d8369405645a03.tar.gz
dotfiles-17f6305e253cc36acec5384c55d8369405645a03.zip
Split out sls(1) into shell and awk
Diffstat (limited to 'bin/slsf')
-rwxr-xr-xbin/slsf9
1 files changed, 9 insertions, 0 deletions
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 }