summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorTommy Reynolds <Tommy.Reynolds@MegaCoder.com>2006-01-16 01:58:12 +0000
committerTommy Reynolds <Tommy.Reynolds@MegaCoder.com>2006-01-16 01:58:12 +0000
commitee7376e7040c4f3382fa567acb36920ddc0749b7 (patch)
treeddd8f6e6ec097f5c213587c1a1561b1d294baff8 /bin
parent9962e608e834805dc4309656cef101250b84744b (diff)
downloadfedora-doc-utils-ee7376e7040c4f3382fa567acb36920ddc0749b7.tar.gz
fedora-doc-utils-ee7376e7040c4f3382fa567acb36920ddc0749b7.tar.xz
fedora-doc-utils-ee7376e7040c4f3382fa567acb36920ddc0749b7.zip
Fedora Documention Project Shell, a wrapper for the "fdp-functions"
functionality that works very much like the original BASH shell.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/fdpsh45
1 files changed, 45 insertions, 0 deletions
diff --git a/bin/fdpsh b/bin/fdpsh
new file mode 100755
index 0000000..b5a15d4
--- /dev/null
+++ b/bin/fdpsh
@@ -0,0 +1,45 @@
+#!/bin/bash
+########################################################################
+# Fedora Documentation Project Interactive Shell
+#
+# Runs BASH after first sourcing the "docs-common/bin/fdp-functions"
+# file.
+#
+# If the "-c cmd" switch is used, exactly one "cmd" is executed.
+# Without a "-c" switch, any file given on the command line is executed.
+# With neither a "-c" switch or command line arguments, commands are
+# accepted from stdin.
+########################################################################
+ME=$(basename $0)
+MYDIR=$(dirname $0)
+USAGE="usage: ${ME} [-c cmd] [file [arg..]]"
+. ${MYDIR}/fdp-functions
+CMD=
+while getopts c: c
+do
+ case "${c}" in
+ c) CMD="${OPTARG}";;
+ *) echo "${USAGE}" >&2; exit 1;;
+ esac
+done
+if [ "${CMD}" ]; then
+ ${CMD}
+ results=$?
+elif [ $# -gt 0 ]; then
+ $@
+ results=$?
+else
+ while :
+ do
+ echo -n "${ME}> " >&2
+ read -e cmd
+ if [ "${cmd}" ]; then
+ ${cmd}
+ results=$?
+ if [ ${results} -gt 0 ]; then
+ echo "Status = ${results}" >&2
+ fi
+ fi
+ done
+fi
+exit ${results}