From f8ff3fe5b92426d2123488a7c0d58efac6f1e63b Mon Sep 17 00:00:00 2001 From: kake26 Date: Sat, 25 Sep 2021 23:43:46 +0200 Subject: [PATCH 1/2] Update 'README.md' Updated readme --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5d1ff1b..0e7ab5a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ # Bash-Stash -A collection of console based bash scripts I've written at various times. It may include scripts written in other languages. \ No newline at end of file +# Console + +These are various useful console scripts. \ No newline at end of file From 67e3a383d79525783681ef06f9da912e0bfa9abc Mon Sep 17 00:00:00 2001 From: Paul Date: Sun, 12 Jun 2022 13:26:38 -0500 Subject: [PATCH 2/2] First working copy of autoload --- .bashrc | 18 ++++++++++++++++++ LICENSE | 0 NOTES | 0 README.md | 0 modules/moo.bash | 6 ++++++ test.bash | 23 +++++++++++++++++++++++ 6 files changed, 47 insertions(+) create mode 100755 .bashrc mode change 100644 => 100755 LICENSE mode change 100644 => 100755 NOTES mode change 100644 => 100755 README.md create mode 100755 modules/moo.bash create mode 100755 test.bash diff --git a/.bashrc b/.bashrc new file mode 100755 index 0000000..33a4e74 --- /dev/null +++ b/.bashrc @@ -0,0 +1,18 @@ +# +# ~/.bashrc +# + +# Stripped of its default items + +function autoload { + #echo "Called by $(caller): Couldn't find ${BASH_COMMAND}" + if [[ -f modules/${BASH_COMMAND}.bash ]] + then + source modules/${BASH_COMMAND}.bash + ${BASH_COMMAND} + else + echo "I can't find ${BASH_COMMAND}" + fi +} + +trap autoload ERR diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/NOTES b/NOTES old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/modules/moo.bash b/modules/moo.bash new file mode 100755 index 0000000..2f0ffc8 --- /dev/null +++ b/modules/moo.bash @@ -0,0 +1,6 @@ +#!/bin/bash +# Test module + +function moo () { + echo "MOOOO!! $1" +} \ No newline at end of file diff --git a/test.bash b/test.bash new file mode 100755 index 0000000..8eb06cb --- /dev/null +++ b/test.bash @@ -0,0 +1,23 @@ +#!/bin/bash + +set -Eeuo pipefail + +# 2>/dev/null + +# Test file + +function autoload { + #echo "Called by $(caller): Couldn't find ${BASH_COMMAND}" + if [[ -f modules/${BASH_COMMAND}.bash ]] + then + source modules/${BASH_COMMAND}.bash + ${BASH_COMMAND} + else + echo "I can't find ${BASH_COMMAND}" + fi + +} + +trap autoload ERR + +moo \ No newline at end of file