"Fossies" - the Fresh Open Source Software Archive

Member "tmv-1.1.3/bin/tmv-strip.sh" (5 Feb 2007, 862 Bytes) of package /linux/privat/old/tmv-1.1.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    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