config root man

Current Path : /compat/linux/proc/68247/root/compat/linux/proc/68247/root/compat/linux/usr/share/doc/bash-3.2/scripts.v2/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //compat/linux/proc/68247/root/compat/linux/proc/68247/root/compat/linux/usr/share/doc/bash-3.2/scripts.v2/newext

#! /bin/bash
#
# original from:
# newext: change filename extension
# @(#) newext.sh 1.1 93/04/13
# 90/06/06 john h. dubois iii (john@armory.com)
# 90/11/14 changed ksh-specific code to hybrid: if running under Bourne,
#          uses expr instead of ksh builtin ops.  Removed SYSV specific code.
# 91/08/06 added -t option
# 92/11/06 made earlier code actually work!
# 93/04/13 If no filenames given, act on files in current dir
#
# conversion to bash v2 syntax by Chet Ramey

usage="Usage: newext [-th] <oldext> <newext> [filename ...]"

phelp()
{
echo "$usage
Rename all given files that end in oldext with newext replacing oldext.
If no filenames are given, all files in the current directory that end
in oldext are acted on (no filename is equivalent to '*').
Options:
-h: Print this help.
-t: Test: No action is taken except to print the mv commands that would
be executed if -t was not given."
}

while getopts "th" opt; do
    case "$opt" in
    t) echo=echo;;
    h) phelp; exit 0;;
    *) echo "$usage" 1>&2; exit 2;;
   esac
done

shift $((OPTIND - 1))

oldext=$1
newext=$2

case $# in 
[01])	echo -e "$usage\nUse -h for help." 1>&2; exit 2;;
2)	shift ; shift; set -- *;;
*)	shift ; shift;;
esac

found=

for file
do
    case "$file" in
    *$oldext) 
	newname="${file%$oldext}$newext"
	$echo mv "$file" "$newname"
	found=true;;
    esac
done

if [ -z "$found" ]; then
    echo "No files ending in \"$oldext\"."
    exit 1
fi
exit 0

Man Man