[vox-tech] help with script
vox-tech@lists.lugod.org
vox-tech@lists.lugod.org
Thu, 3 Oct 2002 17:09:07 -0400
On Thu, Oct 03, 2002 at 12:16:19AM -0700, Peter Jay Salzman wrote:
> i'm allowing my students to turn in their assignments electronically
> this quarter. they're writing C or fortran programs. i'm requiring
> them to turn in:
>
> 1. the program
> 2. a file showing the compile process and the program output.
My recommendation is require that the students turn in a Makefile
with well defined targets... like:
===
make clean - this must remove all temporary files created using
any other make targets
make all - this must compile your program from a clean state
make test - this must run your program with sample input files
"FOO, BAR, BAZ"
===
Have them turn in a raw "script" output showing them run only the
following command: "make clean; make all; make test"... so that
you can see what they "see".
... if these students don't know make, then maybe you can supply them
with a makefile and tell them what sections to change?
> for #2, i'm having them use "script".
If the makefile isn't okay.
It will likely take you much less time to strip out the terminal
crap generated on your end, than it will to write a good shell.
The perl crud below is something I put together quickly for my own
purposes... which mostly works the 'cat -A' gets all extra special
characters on the screen.
perl -ne 'while (s/[^\b][\b] [\b]//g) {}; # remove simple backspaces
s/\e\[[\d;?]*[a-zA-Z\@]//g; # kill most vt100 escapes
s/\e\]0;[^\a]+\a//; # kill vt100 title bar text
s/[\b]//g; # kill other backspaces
s/\r\n/\n/; # strip last carriage return
s/^.*\r//g; # nuke text before remaining cr
s/\a//g; # nuke bells
print'
test | cat -A | less
===
ps:
The only lines that don't really work well are the "backspace"
handling ones... because on a '^H' moves the cursor left display
without removing the character... so when someone arrows to the
left a bunch of ^H are logged. This doesn't track where someone
moves.
===
> i can write a script that presents a shell like interface which short
> circuits this stuff saves their program output to a file, but if
> something is already written, i'd rather go that route.
You are basically thinking about writing a shell...
Unless you have spare time, I would just recommend you continue to
have them use script... since you won't need to spend time developing
something and handling random support issues (maybe like "why doesn't vi
work inside this thing", "why doesn't ^R do a reverse search of my history",
"why doesn't ESC0/^A go to the beginning of line", etc).
TTFN,
Mike