1 #!/bin/sh 2 # 3 # copyright 2003-2005 Gene Pavlovsky <heilong@bluebottle.com> 4 # 5 # this is free software; you can redistribute it and/or modify 6 # it under the terms of the GNU General Public License as published by 7 # the Free Software Foundation; either version 2 of the License, or 8 # (at your option) any later version. 9 # 10 # tmv-strip: strip a string S from the beginning of S*. 11 12 while test $# -gt 0 && test "${1:0:1}" = '-' && test "$1" != '--'; do 13 test -z "$options" && options="$1" || options="$options $1" 14 shift 15 done 16 test "$1" = '--' && shift 17 18 if test $# -lt 1; then 19 { 20 echo "Usage: $(basename $0) [tmv options] string" 21 echo 22 echo "Strips string from files containing string in their pathname." 23 } >&2 24 exit 1 25 fi 26 27 pattern=$(echo "$1" | sed -e 's/\[/\\[/g' -e 's/\\/\\\\/g') 28 find . -maxdepth 1 -name "*$pattern*" | tmv -e "s/$pattern//" $options