In a brief discussion with a coworker today the question of formatting shell scripts came up.
I believed that in the past the preferred format (if there ever were any such thing) was
if [ test ]
then
statements
else
statements
fi
I can find nothing specific to back this up. More appropriate for COFF maybe would
be a discussion of what format is better
if [ test ]; then
statements
else
statements
fi
or the above.
No intention to start any kind of flame war about which is better, just want to see
if there is any historical option for one over the other.
David
if test; then
stuff
and
if test
then
stuff
are functionally equivalent. I wouldn't say one or the
other `is preferred.' I use the former because I think
it's a little more readable because more compact. But
it's really a matter of style, like whether you write
if (test) {
(multi-statement block)
or
if (test)
{
(multi-statement block)
I have a stronger opinion about those who use overly-
cryptic constructions like
test && {
shell commands
}
because it means exactly the same thing as
if test; then
shell commands
but is more obscure to read. But again it's a question
of style, not of dogma.
As an aside, I think one excuse that is sometimes used
for that sort of construct is when it's
test || {
commands
}
because Bourne's original shell had no not operator.
For a long time after shell functions appeared, I would
add this function to any of my shell scripts that needed
it:
not() {
if "$@"; then
return 1
else
return 0
}
so I could say
if not test; then
commands
fi
Modern Bourne-shell descendants have a built-in ! operator:
if ! test; then
commands
fi
I'm not keen on most of what has been stuffed into bash and
ksh and the like, but ! is a real improvement. I believe
POSIX mandates it, and I think they're right.
Norman Wilson
Toronto ON
> From: Paul Riley
> I also have a DEC 256KB board, but I doubt I could use it on the
> '03.
Yes, DEC 256KB boards are what's called Q22, and those don't seem to work with
LSI-11's; not even CPU ODT works. I just tried a 256KB MSV11-L with an LSI-11,
and it definitely doesn't work; the MSV11-P is definitely a Q22 board, and so
probably also won't work.
What the Q22 means is that early in the lifetime of the QBUS, it only had 18
address line - so-called Q18. (Technially the LII-11 used only 16 address lines,
so it's actually Q16.) DEC latter snarfed some of the 'unused' pins, and
made them QDAL18-21. So boards that use those pins for QDAL18-21 are 'Q22'
boards.
My theory on what the problem is is that the LSI-11 uses some of those pins
for other things - I think the 'run' light, IIRC. So that confuses Q22 memory.
If one tries to use one with an LSI-11, the machine is totally dead - not even
ODT. It doesn't do any harm, though; unplug the Q22 memory, and plug in a Q18
card like an MSV11-D, and it'll be fine.
If you need memory for the LSI-11, MSV11-D boards are pretty common on eBait,
for not much. They tend to be flaky, though; sometimes they come back to life
if you leave them sit for a bit after you plug them in.
> I believe the [memory] board is non-DEC.
Well, if it's Q22 it won't work either. Both that and the DEC board should
work in the /23, though. (If you have the part number on the memory chips, a
little arithmetic should give you the board size. 256K and up are generallly
Q22; if you have a manual for that card it might say.)
I'm still working with Mini-Unix; it's very fragile. When I got it running,
the first thing I tried to do was changle the line editing characters (since
my normal ones are burned into ROM). Alas, in stock V6, DEL is hard-wired to
be 'interrupt process', so I can't just 'stty [mumble]', I have to rebuild the
kernel to change that. Not a problem, necessarily - but I edited tty.h and
said 'cc -c tty.c', and it crashed and re-started - and roached the disk. So
I'm still trying to make progress. I might have mis-configured the simulator,
I'll see.
Noel
> Turing save us from 1-complement machines!
Users of Whirlwind II were warned about the quirks of -0.
We were not warned, though, about integer divide with remainder 0.
The result of dividing 6 by 3, for example, was binary 1.111111... -
a valid answer when carried to infinity. Unfortunately, the
"fractional" part was dropped.
Most people used Whirlwind for floating-point computation, and
blithely dismissed printed answers like 1.999999 as "roundoff
errors".
Doug
> So that confuses Q22 memory. If one tries to use one with an LSI-11,
> the machine is totally dead - not even ODT.
Oh, that's another LSI-11 'feature' (only discovered after someone sent in a
help request on CCalk for a dead LSI-11): if there's no working memory at 0,
ODT won't start/run. So if the Q22 memory is confused, the whole machine is dead.
Noel
> From: Paul Riley
> I have two RLV-12/RL02 emulator boards I had made from Peter Schranz's
> design (5volts.ch). They take an SD card
Ah, you're all set, then - doubly so, in fact. Not only do you have reliable
mass storage, but you should be able to put the Unix filesystem on an SD card,
to get the bits into the machine.
I'm not familiar with that board, but it sounds pretty good; QBUS<->SD. I
don't know how that board uses the SD card, in terms of where it keeps the
RL02 image, but if you can find that out, SD<->USB3 adaptors are cheap and
plentiful, and it shouldn't be too hard to load the disk image into it using
one of them. (For the QSIC, I found a 'dd' for Winsdoze and used that to write
the disk image onto the SD card.)
> I don't have any PROMs other than what would be on the '03 or '23+
> boards now.
Not a problem: if you hook up the -11's console to another computer, you
can download a bootstrap into it over the serial line, using the -11's ODT.
(There's a page here:
http://gunkies.org/wiki/Running_an_LSI-11_from_Unix_V6
which talks briefly about how to do that. Things like PDP11GUI can do it too,
I think.) I don't use an RK bootstrap in ROM to boot from the emulated RK11 on
the QSIC; I just load in a short RK bootstrap. I don't know of one lying
around for the RL11, but one would be trivial to whip up.
Speaking of booting, I have Mini-Uix booting under an -11/05 simulator
(Ersatz-11); I used the RK image from here:
http://www.tavi.co.uk/unixhistory/mini-unix/munixrks.zip
and it just started right up. So that's the big hurdle; been busy with other
stuff, but I'll work on getting it to boot on an '03 'soon'.
You probably want to do the same; having it running under a simulator will
make it easy to build new OS images, e.g. for a system with RL02's. Build the
new system, name it 'rlmx', copy the simulator disk image into the SD card,
and away you go.
Oh, I recently realized how to make a bit more room on an -11/03: most
DEC small QBUS memory cards allow you to use half the 'I/O page' for memory,
if you need it. I.e. instead of having 56KB of memory, and 8 KB of
address space for device registers (a lot more than is really needed), the
memory can be configured to be 60KB of memory.
It can be a bit of a hassle to use it; to have more room for the OS (for more
drivers, or disk buffers, or whatever), some pieces of Mini-Unix need to be
recompiled, to move up the address where user processes are loaded. Larger
user processes are the same thing; they aren't automatically enabled when
there's more memory, you have to change a config file, recompile some things,
and build a new system.
What kind of memory card(s) do you have for the -11/03?
Noel
When someone mentioned that they'd ported V6 to the 11/23, I recalled that
I did the same thing (well, V6 + the bits of AUSAM that I liked + the bits
of V7 that I could shoe-horn in), and went looking for the article that I
could've sworn I'd published, using "pdfgrep 23 AUUGN*" in my TUHS mirror.
And yes, I recall some hardware peculiarity which had to be worked around,
but I've forgotten the details (which is why I went looking).
I didn't find it (is there an index of articles anywhere?), but I did find
some peculiar typos, and I was wondering whether they were a result of
Google's (destructive) scanning, or were in the originals.
Here's a quick sample:
AUUGN-V04.5.pdf: tailored for smaller. PDP11s (such as the 11/23 or 11/34) in an
A period after "smaller".
AUUGN-V04.6.pdf: Unfortunately. the clever Code comes unstuck as the LSI-II/23 doesn't’t
The phrase "Unfortunately. the clever Code" looks wrong.
AUUGN-V04.6.pdf:LSI-II/23 was changing the value of r! if the V-bit gets set. It seemed
"r!" should be "r1" (a possible typo, as they are the same key)..
AUUGN-V04.6.pdf: bio23 (662 2668) Elec. Eng., UNSW,
This is a weirdie; "bio23" (one of my clients) was never a part of Elec
Eng (they were their own school), so I suspect a mistake here; it's
possible, however, that they were in the same building.
AUUGN-V04.6.pdf: PDP 11/23 + FPU. RK05, RL02, DRIIb
I believe that "DR11b" should be "DR11B".
AUUGN-V05.1.pdf: PDP 11/23 - System III (Ausam)., 256k, 2xR102, 16 lines
AUSAM under System III, on a mere 11/23? I very much doubt it... Also,
"R102" should probably be "RL02".
AUUGN-V05.1.pdf: PDP 11/23, Q bus + qniverter, RK05, Pertec dual RK05, DEC dual cassette,
I suspect that "qniverter" was a typo on the part of the author.
As a bit of a Unix historian it would be a shame if those AUUGN scans were
less than accurate; I no longer have my hard copies (lost in a house
move), so perhaps someone could check their copies?
Thanks.
-- Dave
> From: Warner Losh
> I'm pretty sure PDP-10 wasn't 1's compliment / was 2's compliment..
Just to confirm, I pulled out my PDP-10 Hardware Reference Manual; Vol I - CPU
(EK-10/20-HR-001), and it does indeed say (pg. 1-12): "The fixed-point
arithmetic instructions use 2's complement representations to do binary
arithmetic." Selah.
Noel
> From: John Cowan
> if you are not messing with the kernel or drivers, I find apout to be
> delightful.
Pretty much all of what little I do with V6 anymore is kernel hacking! :-)
Noel