From 3f6c1435a4cbdf73a65639b05898a01c0dfc21ac Mon Sep 17 00:00:00 2001 From: Pete Travis Date: Wed, 1 Oct 2014 11:33:51 -0600 Subject: we might need this sles10 stuff later --- .../examples/functions/lowercase | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 scratch/bash-3.1-postpatch/examples/functions/lowercase (limited to 'scratch/bash-3.1-postpatch/examples/functions/lowercase') diff --git a/scratch/bash-3.1-postpatch/examples/functions/lowercase b/scratch/bash-3.1-postpatch/examples/functions/lowercase new file mode 100644 index 0000000..3cf6bde --- /dev/null +++ b/scratch/bash-3.1-postpatch/examples/functions/lowercase @@ -0,0 +1,27 @@ +#! /bin/bash +# +# original from +# @(#) lowercase.ksh 1.0 92/10/08 +# 92/10/08 john h. dubois iii (john@armory.com) +# +# conversion to bash v2 syntax done by Chet Ramey + +lowercase() +{ + for file; do + [ -f "$file" ] || continue + filename=${file##*/} + case "$file" in + */*) dirname=${file%/*} ;; + *) dirname=.;; + esac + nf=$(echo $filename | tr A-Z a-z) + newname="${dirname}/${nf}" + if [ "$nf" != "$filename" ]; then + mv "$file" "$newname" + echo "lowercase: $file -> $newname" + else + echo "lowercase: $file not changed." + fi + done +} -- cgit