Skip to content

Instantly share code, notes, and snippets.

@retrospectacus
Last active October 19, 2020 17:10
Show Gist options
  • Save retrospectacus/9409ca7bf41af1ec4cf88b6f064824ff to your computer and use it in GitHub Desktop.
Save retrospectacus/9409ca7bf41af1ec4cf88b6f064824ff to your computer and use it in GitHub Desktop.
Thing to run on a schedule that updates some sort of config. It is a toy to illustrate/test some unix/bash constructs.
#!/usr/bin/env bash
tr=trigger
tr='==============_AUTOGENERATED_-_EDITS_BELOW_WILL_BE_CLOBBERED'
[ ! -f test.conf ] && cat <<EOF >test.conf
this
is a
trigger
test
some config is
probably here
EOF
day=$(date +%A)
[ ! -f data ] && cat <<EOF >data
this is
$day's data.
EOF
fi
cat \
<(awk "/$tr/{exit}{print}" test.conf) \
<(echo "$tr") \
<(date) \
<(uname -a) \
data \
> output
cat output
mv output test.conf
# make external changes to ./test.conf or data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment