From cff0b431f1a3392ee1d7b93bf78c96a8cae04875 Mon Sep 17 00:00:00 2001 From: Bryan Roessler Date: Fri, 2 Aug 2024 21:15:07 -0400 Subject: [PATCH] Eliminate /usr/share/dict/words dependency --- workflow/qhtcp-workflow | 70 +++++++++++++++++++++++++++++++++-------- 1 file changed, 57 insertions(+), 13 deletions(-) diff --git a/workflow/qhtcp-workflow b/workflow/qhtcp-workflow index 10695bcf..694787fe 100755 --- a/workflow/qhtcp-workflow +++ b/workflow/qhtcp-workflow @@ -216,7 +216,7 @@ err() { echo "Error: $*" >&2; } ask_pn() { unset PROJECT declare -ag ADD_PROJECTS - example_pn="${PROJECT_PREFIX}_$(random_words 3)" + example_pn="${PROJECT_PREFIX}_$(random_three_words)" cat <<-EOF Enter a new or existing project name If entering a new project, use the suggested prefix: ${PROJECT_PREFIX}_ @@ -245,17 +245,57 @@ ask_pn() { } debug() { (( DEBUG )) && echo "Debug: $*"; } # Not super portable but nice to have -random_words() { - local num=${1:-2} +random_three_words() { local -a arr - for ((i=0;i> "$HOME/.bashrc" + line="export R_LIBS_USER=$HOME/R/$SCRIPT_NAME" + if ! grep -qF "$line" ~/.bashrc; then + echo "Adding $line to your .bashrc" + echo "If you use a different shell, update your R_LIBS_USER environment variable accordingly" + echo "$line" >> ~/.bashrc + fi fi else debug "R_LIBS_USER already set to $HOME/R/$SCRIPT_NAME"