summaryrefslogtreecommitdiffstats
path: root/cobra
diff options
context:
space:
mode:
authortv <tv@also>2011-06-20 00:49:35 +0200
committertv <tv@also>2011-06-20 00:49:35 +0200
commitfe0739a39d3f5f34efcde6d4611d399dba6b94b5 (patch)
treed84e1d3ba3bba38fe78404e788ef6faf5d70d408 /cobra
parent73aa6e838658a6f38c9de2f01990295576b69ad5 (diff)
cobra: initial index.sh
Diffstat (limited to 'cobra')
-rw-r--r--cobra/hello/index.sh1
-rwxr-xr-xcobra/index.sh20
2 files changed, 21 insertions, 0 deletions
diff --git a/cobra/hello/index.sh b/cobra/hello/index.sh
new file mode 100644
index 00000000..df2dea7c
--- /dev/null
+++ b/cobra/hello/index.sh
@@ -0,0 +1 @@
+echo 'Hello, world!'
diff --git a/cobra/index.sh b/cobra/index.sh
new file mode 100755
index 00000000..e3c5a1ea
--- /dev/null
+++ b/cobra/index.sh
@@ -0,0 +1,20 @@
+#! /bin/sh
+set -euf
+trap "echo 'You are made of stupid!' >&2; exit 23" EXIT
+disarm() {
+ trap - EXIT
+}
+
+COBRA_PATH="${COBRA_PATH-$PWD}"
+
+## main
+for target; do
+ for path in $COBRA_PATH; do
+ if test -d "$path/$target"; then
+ if index="$path/$target/index.sh" && test -f "$index"; then
+ exec /bin/sh "$index"
+ disarm
+ fi
+ fi
+ done
+done