]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/windows/fix-suffixes.sh
patch::: 1.3.149.jcn1
[lilypond.git] / Documentation / windows / fix-suffixes.sh
1 #!/bin/bash
2 ## duh, rename executables,
3 ## for people that use a dumb shell instead of bash
4
5 if [ $# -le 0 ]; then
6         echo "Usage: fix-suffixes [FILE]..."
7         exit 2
8 fi
9
10 echo `basename $0`
11
12 function fix_extension ()
13 {
14         path=$1
15         ext=$2
16         expr="$3"
17         dir=`dirname $path`
18         file=`basename $path`
19         base=`basename $file $ext`
20         if [ $base$ext != $file ]; then
21                 type="`file $path`"
22                 if expr "$type" : "$expr"; then
23                         mv -f $path $dir/$base$ext
24                 fi
25         fi
26 }
27
28 for i in `/bin/ls -d1 $*`; do
29         fix_extension $i .exe '.*Windows.*\(executable\).*'
30         fix_extension $i .py '.*\(python\).*'
31 done
32