Imported from ../bash-3.0.tar.gz.
This commit is contained in:
parent
7117c2d221
commit
b80f6443b6
400 changed files with 69247 additions and 13346 deletions
|
|
@ -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 $?
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)"
|
||||
|
|
|
|||
|
|
@ -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) ***
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"'
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue