diff --git a/simple-setup.sh b/simple-setup.sh index 1f8207b..c84ff9c 100755 --- a/simple-setup.sh +++ b/simple-setup.sh @@ -1,44 +1,9 @@ #!/bin/bash -# A function to make a statement. -declaim () { - echo - echo ${*} - echo "===============" - echo -} - -# A function to print the git command to be executed and then to -# execute it -git_command() { - # Print out the command. - echo - echo "git command: ${*}" - - # Some variable initialisations - COMMANDSTRING="${*}" - counter=0 - UNDERLINESTRING="" - - # Build UNDERLINESTRING to be a string of '-' characters the same - # length of all the options passed in. - while [ ${counter} -lt ${#COMMANDSTRING} ] - do - UNDERLINESTRING="${UNDERLINESTRING}-" - counter=$(( ${counter} + 1 )) - done - - # Print the pretty underline - echo -n " " - echo ${UNDERLINESTRING} - echo - - # Execute the command. - eval ${*} -} - SCRIPT_DIR=$(cd $(dirname ${0}); pwd) +. ${SCRIPT_DIR}/utils.sh + REPO_DIR=${SCRIPT_DIR}/simpleRepo if [ ${#} -eq 1 ]; then diff --git a/utils.sh b/utils.sh new file mode 100644 index 0000000..ca047aa --- /dev/null +++ b/utils.sh @@ -0,0 +1,44 @@ + +if [ "${UTILS_LOADED}" = "Y" ]; then + echo "Returning" + return +fi + +# A function to make a statement. +declaim () { + echo + echo ${*} + echo "===============" + echo +} + +# A function to print the git command to be executed and then to +# execute it +git_command() { + # Print out the command. + echo + echo "git command: ${*}" + + # Some variable initialisations + COMMANDSTRING="${*}" + counter=0 + UNDERLINESTRING="" + + # Build UNDERLINESTRING to be a string of '-' characters the same + # length of all the options passed in. + while [ ${counter} -lt ${#COMMANDSTRING} ] + do + UNDERLINESTRING="${UNDERLINESTRING}-" + counter=$(( ${counter} + 1 )) + done + + # Print the pretty underline + echo -n " " + echo ${UNDERLINESTRING} + echo + + # Execute the command. + eval ${*} +} + +export UTILS_LOADED="Y"