KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /usr/share/doc/bash-3.2/scripts.v2/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/doc/bash-3.2/scripts.v2/shprof
#! /bin/bash
#
# shprof - a line profiler for shell scripts
#
# adapted from a similar program included in `The New KornShell' by
# Bolsky and Korn and posted to usenet by bsh20858@challenger.fhda.edu
#
# converted to bash v2 syntax by Chet Ramey
#
TMPFILE=${TMP:-/tmp}/shprof$$

trap 'rm -f $TMPFILE' EXIT

errexit()
{
	echo $0: "$@" >&2
	exit 1
}

# create script with profiling enabled
cat > $TMPFILE <<- \_EOF_
	declare -a _line
	_profend()
	{
		case "$1" in
		/*|./*)	file="$1" ;;
		*) file=$(type -path "$1") ;;
		esac

		echo "*** line profile for $file ***"
		i=1;
		while read -r && [ $i -le $NLINE ]; do
			count=${_line[$i]}
			if [ "$count" -gt 0 ]; then
				echo "[$count] $i: $REPLY"
			fi
			i=$((i + 1))
		done <$file
_EOF_
# make the profiling script remove itself after printing line stats
echo "rm -f $TMPFILE" >> $TMPFILE
cat >> $TMPFILE <<- \_EOF_
	}
	_command=$1
	shift
	i=1
	NLINE=$(wc -l < "$_command")
	while [ $i -le $NLINE ]; do
		_line[$i]=0
		i=$((i + 1))
	done
	unset i
	trap "_profend ${_command}" EXIT
	trap '_line[$LINENO]=$((${_line[$LINENO]} + 1))' DEBUG
	LINENO=0
_EOF_

case "$1" in
/*|./*)	file=$1 ;;
*)	file=$((type -path "$1")) ;;
esac

cat "${file-$1}" >> $TMPFILE || errexit "${1}: cannot open"
chmod +x $TMPFILE

exec -a "$file" $TMPFILE "$@"

Anon7 - 2021