Imported from ../bash-3.0.tar.gz.

This commit is contained in:
Jari Aalto 2004-07-27 13:29:18 +00:00
commit b80f6443b6
400 changed files with 69247 additions and 13346 deletions

View file

@ -63,7 +63,7 @@ function coprocess ()
shift
local old_trap=$(trap -p SIGPIPE)
trap 'coprocess close -SIGPIPE' SIGPIPE
if [ $# -eq 1 -a "$1" = "--stdin" ] ; then
if [ $# -eq 1 ] && [ "$1" = "--stdin" ] ; then
cat >&61
else
echo "$@" >&61
@ -106,4 +106,3 @@ function coprocess ()
coprocess status
return $?
}

View file

@ -33,15 +33,16 @@ function alias ()
then
declare -f $1
else
echo $2 | egrep -s '(\!|#)' 2>/dev/null
if [ $? -eq 0 ]
then
case $2 in
*[#\!]*)
comm=$(echo $2 | sed 's/\\!\*/\"$\@\"/g
s/\\!:\([1-9]\)/\"$\1\"/g
s/#/\\#/g')
else
comm="$2 \"\$@\""
fi
;;
*)
comm="$2 \"\$@\"" ;;
esac
eval function $1 \(\) "{" command "$comm" "; }"
fi
}

View file

@ -8,7 +8,7 @@ function check_exit_status ()
local status="$?"
local signal=""
if [ ${status} -ne 0 -a ${status} != 128 ]; then
if [ ${status} -ne 0 ] && [ ${status} != 128 ]; then
# If process exited by a signal, determine name of signal.
if [ ${status} -gt 128 ]; then
signal="$(builtin kill -l $((${status} - 128)) 2>/dev/null)"

View file

@ -134,7 +134,7 @@ function getoptex()
let OPTIND || OPTIND=1
[ $OPTIND -lt $# ] || return 1
shift $OPTIND
if [ "$1" != "-" -a "$1" != "${1#-}" ]
if [ "$1" != "-" ] && [ "$1" != "${1#-}" ]
then OPTIND=$[OPTIND+1]; if [ "$1" != "--" ]
then
local o
@ -299,4 +299,3 @@ function getopt()
#**************************************
#*** (end of getopt2) ***

View file

@ -207,7 +207,7 @@ substring ()
;;
esac
# test for too few or too many arguments
if [ x"$1" = x -o $# -gt 2 ]; then
if [ x"$1" = x ] || [ $# -gt 2 ]; then
print -u2 'substring: bad argument count'
return 1
fi

View file

@ -70,7 +70,7 @@ function whatis ()
function apropos ()
{
whatis_internal "$1" "fgrep"
whatis_internal "$1" "grep -F"
}
# Note: "-" and "-t" together not supported. This man could be
@ -102,7 +102,7 @@ function man ()
g="grep -w"
a=$(basename "$2")
else
g=fgrep
g="grep -F"
a="$2"
fi
whatis_internal "$a" "$g"

View file

@ -44,15 +44,15 @@ function recurse
if cd "$1" ; then
for file in $2; do
if [ -f "$file" -o -d "$file" ]; then
if [ -f "$file" ] || [ -d "$file" ]; then
eval "$3"
fi
done
for file in .* * ; do
if [ "$file" = "." -o "$file" = ".." ] ; then
if [ "$file" = "." ] || [ "$file" = ".." ] ; then
continue
fi
if [ -d "$file" -a ! -L "$file" ]; then
if [ -d "$file" ] && [ ! -L "$file" ]; then
recurse "$file" "$2" "$3" "$path"
fi
done
@ -61,4 +61,3 @@ function recurse
}
recurse "$1" "$2" 'echo "$path$file"'

View file

@ -30,7 +30,7 @@ substr()
;;
esac
if [ "$#" -eq 0 -o "$#" -gt 2 ] ; then
if [ "$#" -eq 0 ] || [ "$#" -gt 2 ] ; then
echo "substr: bad argument count"
return 2
fi

View file

@ -32,7 +32,7 @@ substr()
shift $[ $OPTIND -1 ]
fi
if [ "$#" -eq 0 -o "$#" -gt 2 ] ; then
if [ "$#" -eq 0 ] || [ "$#" -gt 2 ] ; then
echo "substr: bad argument count"
return 2
fi

View file

@ -7,15 +7,16 @@ function xalias ()
then
declare -f $1
else
echo $2 | egrep -q '(\!|#)'
if [ $? -eq 0 ]
then
case $2 in
*[#\!]*)
comm=$(echo $2 | sed 's/\\!\*/\"$\@\"/g
s/\\!:\([1-9]\)/\"$\1\"/g
s/#/\\#/g')
else
comm="$2 \"\$@\""
fi
;;
*)
comm="$2 \"\$@\"" ;;
esac
eval function $1 \(\) "{" command "$comm" "; }"
fi
}

View file

@ -39,7 +39,7 @@ xfind()
# and directories that start with a period.
for x in * ; do
if [ -d "$x" -a ! -L "$x" ] ; then
if [ -d "$x" ] && [ ! -L "$x" ] ; then
$FUNCNAME "$x" "$2" "$action"
fi
done