Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: From: "Barnhart, Kevin" To: "'Randall R Schulz'" , "'cygwin AT cygwin DOT com'" Subject: RE: run batch w/o .bat? Date: Wed, 5 Jun 2002 07:01:21 -0600 MIME-Version: 1.0 Content-Type: text/plain 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 AT cris DOT com] > Sent: Tuesday, June 04, 2002 9:21 PM > To: Barnhart, Kevin; cygwin AT cygwin DOT 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/