docs-common/bin fdpsh,NONE,1.1

Tommy Reynolds (jtr) fedora-docs-commits at redhat.com
Mon Jan 16 01:58:19 UTC 2006


Author: jtr

Update of /cvs/docs/docs-common/bin
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv32530

Added Files:
	fdpsh 
Log Message:
Fedora Documention Project Shell, a wrapper for the "fdp-functions"
functionality that works very much like the original BASH shell.



--- NEW FILE fdpsh ---
#!/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}




More information about the Fedora-docs-commits mailing list