This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
run batch w/o .bat?
- From: Lynn Wilson <lynn at swcp dot com>
- To: cygwin <cygwin at cygwin dot com>
- Date: Tue, 04 Jun 2002 20:03:00 -0600
- Subject: run batch w/o .bat?
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/