Without any comments from the programmer stating the intent of the code, it's impossible to tell.
Depending on your command shell, it's usually something like this:
"$?" is usually the value returned from the last command run in a shell. csh is probably different, but I don't remember exactly.
One thing Bourne based shells and csh based shells share is that $? is the exit code of the previous command. But, we're talking about a UNIX Version 6 shell here; not a modern shell. I never used V6 much (although I worked on developing PWB UNIX and MERT both of which were derived from V6). I used the Mashey shell for a while and early versions of the Bourne shell (both of which were developed as replacements for the V6 shell). (As you can probably guess from current shells, the Mashey shell lost out to the Bourne shell; but some Mashey shell features were adopted by the Bourne shell.)
The V6 shell was VERY simple. (You can check out V6 utility man pages here.) Although there is no mention of shell variables or special parameters (e.g., $#, $?, and $!) on the V6 sh(1) man page and it is clear from the description of command execution that there was no $PATH variable, I think the special parameters listed above were provided with their current meanings. Positional parameters aren't even mentioned on the sh(1) man page, but $1 is mentioned on the goto(1) and shift(1) man pages. There were no loops (for, while, or until), but the the goto command could be used with the if command to produce loops. The only file descriptors you could redirect were standard input and standard output. (The BUGS section of the man page says it is a bug that diagnostic messages couldn't be redirected.) The Synopsis for the if command was:
Note that there is no then, else, or fi here. And, as has been noted in this thread, if was a standalone utility; not a shell built-in. If I remember correctly, the only built-ins in V6 sh were chdir (there was no cd then), login, newgrp, shift, and probably exit.
These 2 Users Gave Thanks to Don Cragun For This Post:
Hi!
Im new to all this but the computer club im in has unix i think.
now my questions.
1.is it NTFS i need to partion the harddrive with to be able to use unix?
2.Unix and Linux whats the diffrense?yes im a noob got no idea been using crap windows for ages and hate it.
3.I got a win98... (2 Replies)
Hello Everbody
I hope you can give me a hand, I have some questions
The first one itīs about some message that I donīt know what means, I was looking about it. but nothing. This is the message
rsh: connection from bad port
bsd-gw: Error reading from connection: Bad file number
And my... (4 Replies)
Hi everyone im new to this forums, i just wanted to get started by asking a few question(Im a Unix newbie)
1. How do i sort a file called "dirr" in a ascending order on the 3rd column
2. what does alias on=who do
Thanks in advance!!! (1 Reply)
hey all, I have question when am writing simple shell...
in the child am calling execvp, i want the parent to know when execvp returns - 1. how can i let the parent know the result of execvp
thanks in advance (9 Replies)
1.) I am to write scripts that will be phasetest folder in the home directory.
2.) The folder should have a set-up,phase and display files
I have written a small script which i used to check for the existing users and their password.
What I need help with:
I have a set of questions in a... (19 Replies)
1) The lpr and sort utilities accept input either from a file named on the command line or from standard input.
a)Name two other utilities that function in a similar manner.
b)Name a utility that accepts its input only from standard input.
2) Explain the following error message. What... (10 Replies)
Hello,
I would like to know how we can highlight/select a section of a file in vi and delete that section if we don't want to use the dd command to delete one line at at time. There is one where we don't want to delete the whole line , but up to a certain word. (2 Replies)