From 8d231d0836c307a56c96fd3c31f4c190322a2e6d Mon Sep 17 00:00:00 2001 From: Tommy Reynolds Date: Mon, 16 Jan 2006 05:49:23 +0000 Subject: 1) Make compatible with Bourne shell, bash, korn shell, and Z-Shell. 2) Redirections now work correctly in all modes. So do pipes, (), and the like. 3) Set ${SHELL} environment parameter so that subshells inherit the ". fdp-functions" environment. --- bin/fdpsh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'bin') diff --git a/bin/fdpsh b/bin/fdpsh index b5a15d4..ca682bf 100755 --- a/bin/fdpsh +++ b/bin/fdpsh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ######################################################################## # Fedora Documentation Project Interactive Shell # @@ -10,10 +10,16 @@ # With neither a "-c" switch or command line arguments, commands are # accepted from stdin. ######################################################################## -ME=$(basename $0) -MYDIR=$(dirname $0) +ME=`basename $0` +FDPBINDIR=`dirname $0` USAGE="usage: ${ME} [-c cmd] [file [arg..]]" -. ${MYDIR}/fdp-functions +# +PATH=${FDPBINDIR}:${PATH} export PATH +FDPDIR=${FDPBINDIR}/../.. export FDPDIR +SHELL=${FDPBINDIR}/${ME} export SHELL +# +. ${FDPBINDIR}/fdp-functions +# CMD= while getopts c: c do @@ -23,10 +29,10 @@ do esac done if [ "${CMD}" ]; then - ${CMD} + eval ${CMD} results=$? elif [ $# -gt 0 ]; then - $@ + eval $@ results=$? else while : @@ -34,7 +40,7 @@ else echo -n "${ME}> " >&2 read -e cmd if [ "${cmd}" ]; then - ${cmd} + eval ${cmd} results=$? if [ ${results} -gt 0 ]; then echo "Status = ${results}" >&2 -- cgit