run batch w/o .bat?

Lynn Wilson lynn@swcp.com
Tue Jun 4 20:20:00 GMT 2002


In my $HOME I have a bin directory that I populate with symbolic links to all
*.bat files in my $PATH.  Here is a bash script to populate it...

enjoy.
Lynn

-----------------------
#!/bin/bash

Origpath=$PWD
for Testpath in ${PATH//:/' '} ; do

if [ -d $Testpath ] ; then
    cd $Testpath
    Basepath="$(pwd | cygpath --unix -f -)"
    Batfiles=$( ls -1 *.bat *.bash  2> /dev/null )

    for Batfile in $Batfiles; do
        Realfile="${Basepath}/${Batfile}"
        Linkname=${Batfile##/*/}
        Linkname=${Linkname%%.*}

        Linkname=~/bin/$Linkname
        if [ -e $Linkname ] ; then
            echo Warning... link to $Realfile exists > /dev/stderr
        else
            echo linking $Realfile --- $Linkname
            ##rm -f $Linkfile
            ln -s "$Realfile" "$Linkname"
        fi
    done
fi

done

echo "removing link for ~/bin/pgp"
rm ~/bin/pgp

cd $OrigPath

exit 0

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list