From 359135964c692ea8931edb329ff8265337226811 Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Fri, 29 Sep 2023 12:35:32 -0700 Subject: [PATCH] Add make_scripts shell function to make bash script template --- .../profile/profile.d/functions.sh.tmpl | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/dot_config/profile/profile.d/functions.sh.tmpl b/dot_config/profile/profile.d/functions.sh.tmpl index 5af8c9e..bb46dcb 100644 --- a/dot_config/profile/profile.d/functions.sh.tmpl +++ b/dot_config/profile/profile.d/functions.sh.tmpl @@ -13,6 +13,27 @@ source_env_file() { )" } +make_scripts() ( + for FILE in "$@"; do + make_script "${FILE}" + done +) + +make_script() ( + cat <<-EOF > "${1}" + #!/usr/bin/env bash + + set -euo pipefail + + main() ( + echo "todo" + ) + + main "$@" + EOF + chmod +x "${1}" +) + add_date_prefix() ( DIR=$(dirname "$1") FILE=$(basename "$1")