public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* 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

* Re: run batch w/o .bat?
  2002-06-05  8:06 Barnhart, Kevin
@ 2002-06-05 12:46 ` Jon LaBadie
  0 siblings, 0 replies; 17+ messages in thread
From: Jon LaBadie @ 2002-06-05 12:46 UTC (permalink / raw)
  To: 'cygwin@cygwin.com'

On Wed, Jun 05, 2002 at 08:16:43AM -0600, Barnhart, Kevin wrote:
> 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?

Not sure of bash/cygwin but under Solaris and ksh93 I can get to commands
executed in one shell from another.  Also in the same system I can use fc
in a shell script to access the history list.

Under bash on that Solaris system two bash's say they are using the same
history file, but the recent commands are not immediately available to
a second bash.  Probably buffered in the respective programs and the
history file will be updated later.  Also, fc in a bash script gave me
no output.

Before anyone asks, I'm not near a cygwin system at the moment.

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

* 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

* 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-04 21:11 ` Randall R Schulz
@ 2002-06-05  2:08   ` rich-paul
  0 siblings, 0 replies; 17+ messages in thread
From: rich-paul @ 2002-06-05  2:08 UTC (permalink / raw)
  To: cygwin

Actually, it looks like he was trying to do an oops script, for the
command after, which would be more like:

doh() {
	eval `history 2 | sed '2d;s/\s+[0-9]+\s+\([^\s]+\)/\1.bat'`
}
or for the non-sedders among us:
	gimme the last 2 lines of history
	(now the sed)
	throw away the last line (which will be doh)
	throw away the leading white, the group of digits, and the next
		white
	and append the .bat to the next token.

I haven't tested this, so sorry if the sed is wrong, but I have done an
eval of the output of history, w/o the first number, which worked.

On Tue, Jun 04, 2002 at 08:21:11PM -0700, Randall R Schulz wrote:
> 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/
> 

-- 
Got freedom?  Vote Libertarian:  http://www.lp.org

--
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?
       [not found] <C69F6A9E1E1F5A488C58B168F0875F4005BDA000@riv-exch1.echosta r.com>
@ 2002-06-04 21:11 ` Randall R Schulz
  2002-06-05  2:08   ` rich-paul
  0 siblings, 1 reply; 17+ messages in thread
From: Randall R Schulz @ 2002-06-04 21:11 UTC (permalink / raw)
  To: Barnhart, Kevin, cygwin

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

* 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

* RE: run batch w/o .bat?
       [not found] <C69F6A9E1E1F5A488C58B168F0875F4005BD9FFD@riv-exch1.echosta r.com>
@ 2002-06-04 12:37 ` Larry Hall (RFK Partners, Inc)
  0 siblings, 0 replies; 17+ messages in thread
From: Larry Hall (RFK Partners, Inc) @ 2002-06-04 12:37 UTC (permalink / raw)
  To: Barnhart, Kevin, 'cygwin@cygwin.com'

At 02:06 PM 6/4/2002, Barnhart, Kevin wrote:


>        [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.
>> 

No, it shouldn't be the only option.  You can invoke cmd.exe (or command.com)
in you case with 9x) and pass it the name of your batch file.  With this,
you don't need to alter any batch file contents.  I expect there are other
options as well.

My comment with respect to adding BAT to the list of file extensions to 
recognize has a bit less to do with interactive user-perceived performance 
drops (although there may be some) than overall code complexity and the fact 
that the same argument could be made for other extensions.  In addition, you 
have to consider that this change also affects scripts, so every executable 
invoked in a script will be subject to any performance drain this additional
searching imposes.   However, if this is something you're interested in 
pursuing, it's always easier to evaluate the merits of proposed functionality 
based on a patch.  I'm certainly not trying to discourage you from that route
if you're so inclined.

 



Larry Hall                              lhall@rfk.com
RFK Partners, Inc.                      http://www.rfk.com
838 Washington Street                   (508) 893-9779 - RFK Office
Holliston, MA 01746                     (508) 893-9889 - 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

* 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

* RE: run batch w/o .bat?
       [not found] <C69F6A9E1E1F5A488C58B168F0875F4005BD9FF7@riv-exch1.echosta r.com>
@ 2002-06-04 11:02 ` Larry Hall (RFK Partners, Inc)
  0 siblings, 0 replies; 17+ messages in thread
From: Larry Hall (RFK Partners, Inc) @ 2002-06-04 11:02 UTC (permalink / raw)
  To: Barnhart, Kevin, 'cygwin@cygwin.com'

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

* 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

* Re: run batch w/o .bat?
  2002-06-03 13:32       ` David T-G
@ 2002-06-03 13:44         ` Larry Hall (RFK Partners, Inc)
  0 siblings, 0 replies; 17+ messages in thread
From: Larry Hall (RFK Partners, Inc) @ 2002-06-03 13:44 UTC (permalink / raw)
  To: David T-G, CygWin Users' List

At 04:32 PM 6/3/2002, David T-G wrote:

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


>% particular to get this to happen.  It's just always worked for me, so long as 
>% Cygwin thought the batch file was executable (i.e. chmod +x <name>.bat).  
>
>That's something I also never had to do, but I understand that mount
>means I might (or, conversely, could consider a file *not* executable,
>which was impossible under B20, where I was last and where I still find
>myself thinking at times).


If by this you mean "mount -x" or "mount -X", then "yes".


>% But, of course, creating #!.exe and adding it as the first line to the batch 
>% file is exactly what tells Cygwin that this file should be treated as an 
>% executable.  So #!.exe is just another option if you can't get what you 
>% want/need from chmod (like on 9x/Me systems).
>
>Since I'm on 98, that may be exactly what I need.


OK, then this could be good news for you! ;-)


>% 
>...
>% >*definitely* news to me (and some of the followups intimated that it
>% >might be problematic), I wonder myself if there is a simple way to tell
>...
>% 
>% I'm not sure what posts you're referring to when you suggest that #!.exe
>% is problematic.  I went back and reviewed the thread there and saw no
>% outstanding concerns about #!.exe.  Perhaps you could qualify that statement
>% better.
>
>I suppose I misread Jan's post farther down in the thread, where he says
>that running "foo" still doesn't work.  Unfortunately, the thread peters
>out there.


I think Jan was referring to the desire to type "foo" and have Cygwin 
translate that to "foo.bat" automagically.  That doesn't work now and 
may never, for the reasons I noted above.


>% 
>% Obviously, you're welcome to pursue any .bat file issue you have further but 
>% I see nothing wrong with the observations and solutions posted so far.  They
>% address the stated concern of being able to run a batch file from Cygwin 
>% shells AFAICS.
>
>Yeah, I can keep tacking .bat on the end at the prompt and in the meantime
>keep scratching my head waiting to put the pieces back together again :-)


Sounds like fun. ;-)


Larry Hall                              lhall@rfk.com
RFK Partners, Inc.                      http://www.rfk.com
838 Washington Street                   (508) 893-9779 - RFK Office
Holliston, MA 01746                     (508) 893-9889 - 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

* Re: run batch w/o .bat?
  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)
  0 siblings, 1 reply; 17+ messages in thread
From: David T-G @ 2002-06-03 13:32 UTC (permalink / raw)
  To: CygWin Users' List; +Cc: Larry Hall (RFK Partners, Inc)

[-- Attachment #1: Type: text/plain, Size: 4162 bytes --]

Larry, et al --

...and then Larry Hall (RFK Partners, Inc) said...
% 
% At 03:09 PM 6/3/2002, David T-G wrote:
% >
% >...and then Larry Hall (RFK Partners, Inc) said...
% >% 
...
% >% The email archives is the place to look and look hard for something like 
% >
% >I did, too, but I didn't find anything that looked familiar -- and yet I
% >could swear that I had just seen this go by before.
% 
% Well, like I said, I didn't do anything more than ask for messages with 
% "batch" in them.  Earnie's response was the fourth one based on score.

Yeah; I went farther than that.


% I definitely wasn't looking with something particular in mind.  I just 
% reviewed what was returned in the order it was returned.

Understood.


% 
% >My recollection is that there's a parameter in the cygwin world where you
% >can add .bat to the extensions list that the shell should automatically
% >append to an unqualified name so that it knows to run .bat files just
% >like .exe and .com files.  I haven't found that setting, though.  While
% >it certainly may not exist, I can hardly believe that I dreamed it or
% >that I so badly misremembered something else...
% 
% 
% I can't clarify your memory for you either.  I can say that I don't know 

You can't?!?  Darn; I keep looking for someone who can help me with
that ;-)


% of such a facility.  The closest I know of is an analogous one in DOS which
% uses PATHEXT.  That said, I've never had a problem with typing the full name 

Hmmm...  That sounds familiar; maybe I have the two reversed.  Time for
more searching...


% to the batch file (i.e. <name>.bat) at the bash (or ash for that matter) 
% prompt and getting the batch file to run properly.  I haven't set anything in 

Same here; it's just nice to not have to remember to tack on the .bat if
possible.


% particular to get this to happen.  It's just always worked for me, so long as 
% Cygwin thought the batch file was executable (i.e. chmod +x <name>.bat).  

That's something I also never had to do, but I understand that mount
means I might (or, conversely, could consider a file *not* executable,
which was impossible under B20, where I was last and where I still find
myself thinking at times).


% But, of course, creating #!.exe and adding it as the first line to the batch 
% file is exactly what tells Cygwin that this file should be treated as an 
% executable.  So #!.exe is just another option if you can't get what you 
% want/need from chmod (like on 9x/Me systems).

Since I'm on 98, that may be exactly what I need.


% 
...
% >*definitely* news to me (and some of the followups intimated that it
% >might be problematic), I wonder myself if there is a simple way to tell
...
% 
% I'm not sure what posts you're referring to when you suggest that #!.exe
% is problematic.  I went back and reviewed the thread there and saw no
% outstanding concerns about #!.exe.  Perhaps you could qualify that statement
% better.

I suppose I misread Jan's post farther down in the thread, where he says
that running "foo" still doesn't work.  Unfortunately, the thread peters
out there.


% 
% Obviously, you're welcome to pursue any .bat file issue you have further but 
% I see nothing wrong with the observations and solutions posted so far.  They
% address the stated concern of being able to run a batch file from Cygwin 
% shells AFAICS.

Yeah, I can keep tacking .bat on the end at the prompt and in the meantime
keep scratching my head waiting to put the pieces back together again :-)


% 
% Larry Hall                              lhall@rfk.com
% RFK Partners, Inc.                      http://www.rfk.com
% 838 Washington Street                   (508) 893-9779 - RFK Office
% Holliston, MA 01746                     (508) 893-9889 - FAX


Thanks & HAND

:-D
-- 
David T-G                      * It's easier to fight for one's principles
(play) davidtg@justpickone.org * than to live up to them. -- fortune cookie
(work) davidtgwork@justpickone.org
http://www.justpickone.org/davidtg/    Shpx gur Pbzzhavpngvbaf Qrprapl Npg!


[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: run batch w/o .bat?
  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
  0 siblings, 1 reply; 17+ messages in thread
From: Larry Hall (RFK Partners, Inc) @ 2002-06-03 12:52 UTC (permalink / raw)
  To: David T-G, CygWin Users' List

At 03:09 PM 6/3/2002, David T-G wrote:
>Larry, et al --
>
>...and then Larry Hall (RFK Partners, Inc) said...
>% 
>% At 02:27 PM 6/3/2002, Barnhart, Kevin wrote:
>% >
>% >I'm a new user to Cygwin, and although I'm sure someone has asked this
>% >question before, I'll ask it again (since I sure can't seem to find it in
>% >the FAQ or the archives).
>% 
>% The email archives is the place to look and look hard for something like 
>
>I did, too, but I didn't find anything that looked familiar -- and yet I
>could swear that I had just seen this go by before.


Well, like I said, I didn't do anything more than ask for messages with 
"batch" in them.  Earnie's response was the fourth one based on score.
I definitely wasn't looking with something particular in mind.  I just 
reviewed what was returned in the order it was returned.


>My recollection is that there's a parameter in the cygwin world where you
>can add .bat to the extensions list that the shell should automatically
>append to an unqualified name so that it knows to run .bat files just
>like .exe and .com files.  I haven't found that setting, though.  While
>it certainly may not exist, I can hardly believe that I dreamed it or
>that I so badly misremembered something else...


I can't clarify your memory for you either.  I can say that I don't know 
of such a facility.  The closest I know of is an analogous one in DOS which
uses PATHEXT.  That said, I've never had a problem with typing the full name 
to the batch file (i.e. <name>.bat) at the bash (or ash for that matter) 
prompt and getting the batch file to run properly.  I haven't set anything in 
particular to get this to happen.  It's just always worked for me, so long as 
Cygwin thought the batch file was executable (i.e. chmod +x <name>.bat).  
But, of course, creating #!.exe and adding it as the first line to the batch 
file is exactly what tells Cygwin that this file should be treated as an 
executable.  So #!.exe is just another option if you can't get what you 
want/need from chmod (like on 9x/Me systems).


>Having done quite a search through the archives since the question was
>first posted, and having found nothing but your #!.exe idea, which was
>*definitely* news to me (and some of the followups intimated that it
>might be problematic), I wonder myself if there is a simple way to tell
>bash to handle .bat files directly rather than mucking about with a #!
>executable...

I'm not sure what posts you're referring to when you suggest that #!.exe
is problematic.  I went back and reviewed the thread there and saw no
outstanding concerns about #!.exe.  Perhaps you could qualify that statement
better.

Obviously, you're welcome to pursue any .bat file issue you have further but 
I see nothing wrong with the observations and solutions posted so far.  They
address the stated concern of being able to run a batch file from Cygwin 
shells AFAICS.




Larry Hall                              lhall@rfk.com
RFK Partners, Inc.                      http://www.rfk.com
838 Washington Street                   (508) 893-9779 - RFK Office
Holliston, MA 01746                     (508) 893-9889 - 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

* Re: run batch w/o .bat?
  2002-06-03 11:54 ` 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)
  1 sibling, 1 reply; 17+ messages in thread
From: David T-G @ 2002-06-03 12:09 UTC (permalink / raw)
  To: CygWin Users' List

[-- Attachment #1: Type: text/plain, Size: 1620 bytes --]

Larry, et al --

...and then Larry Hall (RFK Partners, Inc) said...
% 
% At 02:27 PM 6/3/2002, Barnhart, Kevin wrote:
% >
% >I'm a new user to Cygwin, and although I'm sure someone has asked this
% >question before, I'll ask it again (since I sure can't seem to find it in
% >the FAQ or the archives).
% 
% The email archives is the place to look and look hard for something like 

I did, too, but I didn't find anything that looked familiar -- and yet I
could swear that I had just seen this go by before.

My recollection is that there's a parameter in the cygwin world where you
can add .bat to the extensions list that the shell should automatically
append to an unqualified name so that it knows to run .bat files just
like .exe and .com files.  I haven't found that setting, though.  While
it certainly may not exist, I can hardly believe that I dreamed it or
that I so badly misremembered something else...

Having done quite a search through the archives since the question was
first posted, and having found nothing but your #!.exe idea, which was
*definitely* news to me (and some of the followups intimated that it
might be problematic), I wonder myself if there is a simple way to tell
bash to handle .bat files directly rather than mucking about with a #!
executable...


TIA for me, too, & HAND

:-D
-- 
David T-G                      * It's easier to fight for one's principles
(play) davidtg@justpickone.org * than to live up to them. -- fortune cookie
(work) davidtgwork@justpickone.org
http://www.justpickone.org/davidtg/    Shpx gur Pbzzhavpngvbaf Qrprapl Npg!


[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: run batch w/o .bat?
       [not found] <C69F6A9E1E1F5A488C58B168F0875F4005BD9FF1@riv-exch1.echosta r.com>
@ 2002-06-03 11:54 ` Larry Hall (RFK Partners, Inc)
  2002-06-03 11:28   ` Barnhart, Kevin
  2002-06-03 12:09   ` David T-G
  0 siblings, 2 replies; 17+ messages in thread
From: Larry Hall (RFK Partners, Inc) @ 2002-06-03 11:54 UTC (permalink / raw)
  To: Barnhart, Kevin, 'cygwin@cygwin.com'

At 02:27 PM 6/3/2002, Barnhart, Kevin wrote:
>Hi All,
>
>I'm a new user to Cygwin, and although I'm sure someone has asked this
>question before, I'll ask it again (since I sure can't seem to find it in
>the FAQ or the archives).


The email archives is the place to look and look hard for something like 
this.  I know wading through the results is hard.  Still, I found the
answer to this one by simply searching for "batch".  Granted, the number
of matches was 757 but the exact answer (below) was the fourth match.  
Don't be scared off by the number of results.  Look closely at
the first 10 or so and you'll likely find something useful if not the 
answer.


>How would I go about running my batch files in  bash so that I don't have to
>add the .bat extension?

http://sources.redhat.com/ml/cygwin/2001-03/msg01847.html



--
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-03 11:28   ` Barnhart, Kevin
  0 siblings, 0 replies; 17+ messages in thread
From: Barnhart, Kevin @ 2002-06-03 11:28 UTC (permalink / raw)
  To: 'cygwin@cygwin.com'

Hi All,

I'm a new user to Cygwin, and although I'm sure someone has asked this
question before, I'll ask it again (since I sure can't seem to find it in
the FAQ or the archives).

How would I go about running my batch files in  bash so that I don't have to
add the .bat extension?

TIA,
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

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 --
2002-06-04 16:03 run batch w/o .bat? Barnhart, Kevin
  -- strict thread matches above, loose matches on Subject: below --
2002-06-05  8:06 Barnhart, Kevin
2002-06-05 12:46 ` Jon LaBadie
2002-06-05  6:09 Barnhart, Kevin
     [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-04 20:20 Lynn Wilson
     [not found] <C69F6A9E1E1F5A488C58B168F0875F4005BD9FFD@riv-exch1.echosta r.com>
2002-06-04 12:37 ` Larry Hall (RFK Partners, Inc)
2002-06-04 11:49 Barnhart, Kevin
     [not found] <C69F6A9E1E1F5A488C58B168F0875F4005BD9FF7@riv-exch1.echosta r.com>
2002-06-04 11:02 ` Larry Hall (RFK Partners, Inc)
2002-06-04  9:42 Barnhart, Kevin
     [not found] <C69F6A9E1E1F5A488C58B168F0875F4005BD9FF1@riv-exch1.echosta r.com>
2002-06-03 11:54 ` 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)

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).