3 messages in com.perforce.perforce-userNeed Script| From | Sent On | Attachments |
|---|---|---|
| Lee | 14 Jul 1999 15:12 | |
| Yari...@cimatron.co.il | 14 Jul 1999 23:51 | |
| Dave...@vignette.com | 15 Jul 1999 07:15 |
| Subject: | Need Script![]() |
|---|---|
| From: | Dave...@vignette.com (Dave...@vignette.com) |
| Date: | 07/15/1999 07:15:17 AM |
| List: | com.perforce.perforce-user |
From: "Lee, Sammie" <sglee at evolvesoftware.com>
> Date: Wed, 14 Jul 1999 15:12:47 -0700 > > Hi! > > I would like to know if there is a UNIX-like 'script' utility for > Windows NT. > I would like to capture my compilation and examine the output after a > build. > > I have MKS Toolkit for Windows NT. I tried using the 'tee' command, but > that does not work. A coworker has written a Perl script that takes > arguments > and parses them. When I append '| tee myoutput' to the command line, > his Perl script tries to parse them. > > Thanks, > > Sammie >
Here's what we do, which works for both unix and nt, using mks toolkit on nt:
# always append to the logfile to keep build history around if [ "$APPENDLOG" -eq 1 ] ; then exec >> logfile 2>&1 else exec > logfile 2>&1 fi
[rest of build script follows...]
Also, with regard to perl in the mks toolkit, I found it essentially broken in a few important respects - doesn't accept arguments - cannot be executed without specifying the .pl extension
In researching the fixes for this, I found mention that perl on nt will not work with pipes...
anyway, if you're interested, here is my cheatsheet for making perl work reasonably:
Perl Environment Setup for Windows NT
The initial setup for perl provided by the mks toolkit is broken in several
important aspects.
First is that perl scripts cannot accept any arguments! They cannot be executed without specifying the .pl extension.
To fix these problems:
1.At the DOS command prompt, execute this command: (under ksh, omit the "=")
ASSOC .pl=PerlScript
2.Again, at the DOS command prompt. (under ksh, omit the "=")
FTYPE PerlScript=C:\mksnt\perl.exe %1 %*
3.Set PATHEXT:
set PATHEXT=.COM;.EXE;.KSH;.BAT;.CMD;.PL;
The trailing ";" is important, without it the mks shell will no longer execute shell scripts without extensions.
The ASSOC and FTYPE command will change the NT Registry, and it is probably best to add the PATHEXT environment variable to the registry as well, otherwise you will have to set it for each shell. This can be done under Start:Settings:Control Panel:System:Environment:User Variables
Perl scripts must have a .pl extension. For scripts that will run on both solaris and nt, I create the script as scriptname.pl and create a link to it as scriptname. Thus on solaris scriptname will execute the script, and on nt, scriptname will also execute the script.
When writing scripts to be used on both NT and solaris, I have found some things to beware of.
When doing system calls, beware that path backslashes will cause
problems as it seems that system calls may be
executed in dos. Of course, this also means that regular slashes will cause
problems.
When doing system calls to call another perl script, you should (perhaps must) pass at lease one argument with double quotes around it even if it is null. It seems that otherwise the script will not be executed as a perl script, and the outcome is usually a syntax error that often looks like this:
sub: nt2.pl 23: not found nt2.pl 26: syntax error: got (, expecting Newline
hope this helps,
dave




