public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* RE: run batch w/o .bat?
@ 2002-06-04  9:42 Barnhart, Kevin
  0 siblings, 0 replies; 17+ messages in thread
From: Barnhart, Kevin @ 2002-06-04  9:42 UTC (permalink / raw)
  To: 'cygwin@cygwin.com'

	[Barnhart, Kevin]  What sort of worms?  How big is the can?

	Performance issues = me having to edit new batch files all the time.

	Kevin 

> <snip>
> 
> 
> >Same here; it's just nice to not have to remember to tack on the .bat if
> >possible.
> >
> 
> 
> Right.  This has been discussed.  It could be added but it opens up a can
> of
> worms and would likely result in performance issues as well.  Searching
> for
> foo.exe and foo.bat (and foo.com and foo.sh and ...) whenever someone
> types
> "foo" is not ideal.
> 
> 

--
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/

^ permalink raw reply	[flat|nested] 17+ messages in thread
[parent not found: <C69F6A9E1E1F5A488C58B168F0875F4005BD9FF7@riv-exch1.echosta r.com>]
* RE: run batch w/o .bat?
@ 2002-06-04 11:49 Barnhart, Kevin
  0 siblings, 0 replies; 17+ messages in thread
From: Barnhart, Kevin @ 2002-06-04 11:49 UTC (permalink / raw)
  To: 'cygwin@cygwin.com'



	[Barnhart, Kevin]  As I understand it, the only alternative right
now is to place #! at the beginning of each of my batch files.  You
mentioned that having the shell program sort through for .bat in addition to
other extensions would be a performance issue.  I was just commenting that
this alternative would probably be worse than the fraction of a second that
the shell would have to take to look at some additional files.  I'm probably
more of a special case, though (which is why this would be a nice option). 

	>>  >>        Performance issues = me having to edit new batch files
all the time.


	>> OK but I really have no idea what this statement means in the
context of 
> this thread.
> 
> 
> 

--
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/

^ permalink raw reply	[flat|nested] 17+ messages in thread
[parent not found: <C69F6A9E1E1F5A488C58B168F0875F4005BD9FFD@riv-exch1.echosta r.com>]
* RE: run batch w/o .bat?
@ 2002-06-04 16:03 Barnhart, Kevin
  0 siblings, 0 replies; 17+ messages in thread
From: Barnhart, Kevin @ 2002-06-04 16:03 UTC (permalink / raw)
  To: 'cygwin@cygwin.com'

Actually, I would settle for something like the following:

alias 'bat'='!:0-0.bat !:1*'

I'd like to add this into .bashrc.  Problem is that when I type in 'bat' at
the command line I get the following error:
bash: !:0-0.bat: command not found

I'm tried to escape the bang with a '\', but to no avail.  If I type:
!:0-0.bat !:1*
at the command line then there is no problem--it does what is supposed to,
which is to append '.bat' to the 0-word of the previous command.

Help?

Kevin


> -----Original Message-----
> From:	Larry Hall (RFK Partners, Inc) [SMTP:lhall@rfk.com]
> Sent:	Tuesday, June 04, 2002 11:56 AM
> To:	Barnhart, Kevin; 'cygwin@cygwin.com'
> Subject:	RE: run batch w/o .bat?
> 
> At 12:32 PM 6/4/2002, Barnhart, Kevin wrote:
> >        [Barnhart, Kevin]  What sort of worms?  
> 
> I think my last sentence sums it up.  Also, if you take a look at the
> code responsible for figuring out what's an executable and what's not in
> Cygwin, you'll likely get a better feel for the scope of the issue here.
> 
> 
> >      How big is the can?
> 
> 
> No matter what size can you give me, I can find more worms than will fit
> in
> it! ;-)
> 
> 
> 
> >        Performance issues = me having to edit new batch files all the
> time.
> 
> 
> OK but I really have no idea what this statement means in the context of 
> this thread.
> 
> 
> >        Kevin 
> >
> >> <snip>
> >> 
> >> 
> >> >Same here; it's just nice to not have to remember to tack on the .bat
> if
> >> >possible.
> >> >
> >> 
> >> 
> >> Right.  This has been discussed.  It could be added but it opens up a
> can
> >> of
> >> worms and would likely result in performance issues as well.  Searching
> >> for
> >> foo.exe and foo.bat (and foo.com and foo.sh and ...) whenever someone
> >> types
> >> "foo" is not ideal.
> >> 
> >> 
> >
> >--
> >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/

--
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/

^ permalink raw reply	[flat|nested] 17+ messages in thread
* run batch w/o .bat?
@ 2002-06-04 20:20 Lynn Wilson
  0 siblings, 0 replies; 17+ messages in thread
From: Lynn Wilson @ 2002-06-04 20:20 UTC (permalink / raw)
  To: cygwin

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/

^ permalink raw reply	[flat|nested] 17+ messages in thread
[parent not found: <C69F6A9E1E1F5A488C58B168F0875F4005BDA000@riv-exch1.echosta r.com>]
* RE: run batch w/o .bat?
@ 2002-06-05  6:09 Barnhart, Kevin
  0 siblings, 0 replies; 17+ messages in thread
From: Barnhart, Kevin @ 2002-06-05  6:09 UTC (permalink / raw)
  To: 'Randall R Schulz', 'cygwin@cygwin.com'

Yeah, I ran into the fact that you can't use bash history commands in shell
scripts while searching through the bash docs yesterday :(  I found a number
of different ways to do what you have done below, but isn't there some way
that I can recall the last history command inside of the shell script??!!

Kevin

> -----Original Message-----
> From:	Randall R Schulz [SMTP:rrschulz@cris.com]
> Sent:	Tuesday, June 04, 2002 9:21 PM
> To:	Barnhart, Kevin; cygwin@cygwin.com
> Subject:	RE: run batch w/o .bat?
> 
> Kevin,
> 
> BASH's aliases do not have all the functionality of CSH/TCSH aliases. In 
> particular, they cannot access the history mechanism. If you want to do 
> more than simple left-substitution of the command name, you should use a 
> shell procedure instead.
> 
> This should be equivalent to what you're trying:
> 
> bat() {
>          batName="$1.bat"
>          shift
>          "$batName" "$@"
> }
> 
> 
> Randall Schulz
> Mountain View, CA USA
> 
> 
> 
> At 14:46 2002-06-04, Barnhart, Kevin wrote:
> >Actually, I would settle for something like the following:
> >
> >alias 'bat'='!:0-0.bat !:1*'
> >
> >I'd like to add this into .bashrc.  Problem is that when I type in 'bat'
> at
> >the command line I get the following error:
> >bash: !:0-0.bat: command not found
> >
> >I'm tried to escape the bang with a '\', but to no avail.  If I type:
> >!:0-0.bat !:1*
> >at the command line then there is no problem--it does what is supposed
> to,
> >which is to append '.bat' to the 0-word of the previous command.
> >
> >Help?
> >
> >Kevin

--
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/

^ permalink raw reply	[flat|nested] 17+ messages in thread
* RE: run batch w/o .bat?
@ 2002-06-05  8:06 Barnhart, Kevin
  2002-06-05 12:46 ` Jon LaBadie
  0 siblings, 1 reply; 17+ messages in thread
From: Barnhart, Kevin @ 2002-06-05  8:06 UTC (permalink / raw)
  To: 'Jon LaBadie', 'cygwin@cygwin.com'

Yes, I could see how that might be a problem.  But aren't the commands that
I type in an open shell only available in that shell?  I.e. if I have two
bash windows open, and I type a command in one, then I can't access it
(using !! or otherwise) from the other--or at least I haven't been able to.
That aside, isn't there a way to use the 'fc' command to grab the last
command from the history and then edit it?

> -----Original Message-----
> From:	Jon LaBadie [SMTP:jcyg@jgcomp.com]
> Sent:	Wednesday, June 05, 2002 8:10 AM
> To:	Barnhart, Kevin
> Subject:	Re: run batch w/o .bat?
> 
> On Wed, Jun 05, 2002 at 07:01:21AM -0600, Barnhart, Kevin wrote:
> > Yeah, I ran into the fact that you can't use bash history commands in
> shell
> > scripts while searching through the bash docs yesterday :(  I found a
> number
> > of different ways to do what you have done below, but isn't there some
> way
> > that I can recall the last history command inside of the shell
> script??!!
> > 
> 
> Cmd history generally only tracks interactive session cmds.
> I know you are dealing with a special case, interactive,
> the script is the next cmd.  But for a generic shell script,
> how could it tell which cmd to go back to?  Some interactive
> session (you can have multiple sessions going on) might
> have put more cmds into the history file.
> 
> -- 
> Jon H. LaBadie                  jcyg@jgcomp.com
>  JG Computing
>  4455 Province Line Road        (609) 252-0159
>  Princeton, NJ  08540-4322      (609) 683-7220 (fax)

--
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/

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2002-06-05 18:24 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <C69F6A9E1E1F5A488C58B168F0875F4005BD9FF1@riv-exch1.echosta r.com>
2002-06-03 11:54 ` run batch w/o .bat? Larry Hall (RFK Partners, Inc)
2002-06-03 11:28   ` Barnhart, Kevin
2002-06-03 12:09   ` David T-G
2002-06-03 12:52     ` Larry Hall (RFK Partners, Inc)
2002-06-03 13:32       ` David T-G
2002-06-03 13:44         ` Larry Hall (RFK Partners, Inc)
2002-06-04  9:42 Barnhart, Kevin
     [not found] <C69F6A9E1E1F5A488C58B168F0875F4005BD9FF7@riv-exch1.echosta r.com>
2002-06-04 11:02 ` Larry Hall (RFK Partners, Inc)
2002-06-04 11:49 Barnhart, Kevin
     [not found] <C69F6A9E1E1F5A488C58B168F0875F4005BD9FFD@riv-exch1.echosta r.com>
2002-06-04 12:37 ` Larry Hall (RFK Partners, Inc)
2002-06-04 16:03 Barnhart, Kevin
2002-06-04 20:20 Lynn Wilson
     [not found] <C69F6A9E1E1F5A488C58B168F0875F4005BDA000@riv-exch1.echosta r.com>
2002-06-04 21:11 ` Randall R Schulz
2002-06-05  2:08   ` rich-paul
2002-06-05  6:09 Barnhart, Kevin
2002-06-05  8:06 Barnhart, Kevin
2002-06-05 12:46 ` Jon LaBadie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).