more@ucf-cs.UUCP (06/10/83)
I've been using a Callan Data Systems Unistar 200 with Unix vers. 3.0. I'm trying to get a login program to run which essentially asks what kind of terminal you are on. The problem is that I can't seem to get the program to take input from the keyboard. The program segment I'm having trouble with looks like this: . . echo -n "What kind of terminal is this <$ttytype>?" set answer = ($<) . . When the shell gets to the "set answer = ($<)" line I get a "Variable syntax." message and execution of the .login file gets aborted. I have tried all kinds of things to get input from the keyboard but to no avail. Does anyone have any suggestions on how to do this? Duane N. More ...!duke!ucf-cs!more -- Duane N. More
fair@ucbvax.UUCP (06/15/83)
The construction: set foo=$< is a 4 BSD Vax csh idiom. Instead, I like to use: set foo=(`head -1`) which has the same effect. For those of you out there with UniSoft's port of UNIX to the 68000, their csh documentation came from a Vax, and they didn't quite get all the Vax idioms out of it. Erik E. Fair ucbvax!fair fair@ucb-arpa ucbvax!dual!fair Dual Systems Corporation
pdl@root44.UUCP (06/17/83)
Yup, a simple way round the problem of the `Variable syntax' message etc. is to not use `csh', but use a sensible command interpreter (e.g. sh). See profile(5) in the system III manual for an example of a .profile file that does what you want. Never afraid to abuse lousy software, Dave Lukes (...!vax135!ukc!root44!pdl)
guy@rlgvax.UUCP (06/28/83)
The redirection mechanism for stderr in csh isn't too good either; you simply CAN NOT send stderr down stdout and redirect them both to a pipe! This means you can't say something like make 2>&1 | tee /tmp/makelog in the C shell. Also, you can't redirect stderr other than down stdout. The syntax for the control flow constructs isn't that much more cryptic than the C shell's (which resembles C's constructs about as much as the Bourne shell's resemble Algol 68's). And people have added history and aliasing mechanisms to the Bourne shell, and job control could be added if somebody is ambitious enough. Face it, there are plenty of reasons to like or dislike both shells - I've found the Bourne shell quite friendly and easy to use. Did the C shell originally support the ability to type control structures (loops, etc.) at the terminal, or the ability to capture the standard output of a command and substitute it back into a command line? Guy Harris Computer Consoles, Inc. Office Systems Group {seismo,mcnc,we13,brl-bmd,allegra}!rlgvax!guy
fair@ucbvax.UUCP (06/28/83)
For Dave Lukes, somewhere in the U.K.: =~ (flame ON) The infamous Bourne shell (/bin/sh) is a horror to do anything with. It's sole purpose, in so far as I am concerned is to invoke other programs in a non-interactive way. (ex. popen(3) or system(3)). It is small and fast, and therefore nearly acceptable for this purpose. It is unacceptable for interactive use, because it is missing a history mechanism, because its if, while, (and other such "flow control" statements) have very cryptic syntax, and because the redirection mechanism for stderr is insane. It is unacceptable for scripts for most of the same reasons. Whew! ~= (flame OFF) Now in a more subdued tone, I should say that which shell you use is largely a matter of taste & religion (like editors), and I have found that I like csh better than sh, and the majority of the programmers who use Unix that I know prefer csh to sh. Csh can do some things which I consider a necessity in a command interpreter. Among other things, I am thankful that I have a choice! Many of the existing OS's in the world today don't offer one a choice, so the users are stuck with one person's (or programming team's) idea of what a command interpreter should be. Erik E. Fair ucbvax!fair fair@Berkeley ucbvax!dual!fair Dual Systems Corporation P.S. Of course the fact that I learned Unix at Berkeley has something to do with which shell I use. On the other hand, I like to think of myself as being flexible. After all, I prefer using vi to TOPS-20 EMACS, and I learned EMACS first.
kline@uiucuxc.UUCP (06/30/83)
#R:ucf-cs:-96400:uiucuxc:3700057:000:334 uiucuxc!kline Jun 29 22:31:00 1983 You use |& in the C shell to pipe both stdout and stderr down a pipe. Also, set term = $< works fine in reading a line from the terminal and assigning it to the shell variable 'term'. I use it before my 'tset' so I have time to read the message of the day before the tset clears the screen. Charley Kline, U of I CSO.
tower@inmet.UUCP (06/30/83)
#R:ucf-cs:-96400:inmet:5800003:000:281 inmet!tower Jun 29 09:09:00 1983 I recently had an application (that I should have coded in c, but I needed it fast) that I choose to do in the bourne shell, because it had fewer special characters that needed escaping than the c-shell. All tools have appropriate uses. -len tower harpo!inmet!tower Cambridge, MA
fair@ucbvax.UUCP (07/03/83)
The redirection mechanism for stderr in csh isn't too good either; you simply CAN NOT send stderr down stdout and redirect them both to a pipe! This means you can't say something like make 2>&1 | tee /tmp/makelog in the C shell. Also, you can't redirect stderr other than down stdout. The syntax for the control flow constructs isn't that much more cryptic than the C shell's (which resembles C's constructs about as much as the Bourne shell's resemble Algol 68's). And people have added history and aliasing mechanisms to the Bourne shell, and job control could be added if somebody is ambitious enough. Face it, there are plenty of reasons to like or dislike both shells - I've found the Bourne shell quite friendly and easy to use. Did the C shell originally support the ability to type control structures (loops, etc.) at the terminal, or the ability to capture the standard output of a command and substitute it back into a command line? Guy Harris Computer Consoles, Inc. Office Systems Group {seismo,mcnc,we13,brl-bmd,allegra}!rlgvax!guy Actually, there is a way to redirect stdout & stderr down a pipe. The syntax is thus: program |& program Neatly consistent with the method of redirecting stdout & stderr to a file, wouldn't you say? Also, a construction that turned up in unix-wizards not too long ago for directing stdout & stderr to different places: (program > stdout) >& stderr I don't know too much about csh's early history (no pun intended!), so I can't answer the question directly, but I imagine, since csh was written as an alternative to to sh, it probably had all the features of sh, with other things thrown in for good measure. The definitive answer would have to come from Bill Joy, of course, since he wrote it. Erik E. Fair ucbvax!fair fair@BERKELEY {ucbvax,amd70}!dual!fair Dual Systems Corporation
pdl@root44.UUCP (07/08/83)
>From Dave Lukes ``somewhere in the UK'' (...!vax135!ukc!root44!pdl, actually). >>>>>>>>>> FLAME ON <<<<<<<<<<: Steven Bourne put it best: ``the Cshell was an experiment: now we can get it right'' (that was the gist of what he said, at the EUUG meeting in Bonn). History: This has no place in the command language, it should be at a lower level (what happens if I want to resubmit a command to my editor? Are you going to put a history mechanism into vi ??) So, history shouldn't be there, now the only other advantage of csh is aliases, and Mr. Bourne has a much nicer mechanism (called functions) for doing what aliases do (and a LOT more besides), in a much nicer way (e.g. you can take ANY shell script, put a 1 line header and trailer on it, making it into a function, and it works just the same, but is much quicker, etc. etc.). So: aliases are junk, too. What's left in csh that's of any use ?? A foul and unpleasant control syntax, limited redirection facilities (see the Shell Tutorial in the System 5 manual for examples for examples of whizzo things that can be done with a decent i/o redirection mechanism), and a dumb and arbitrary lack of compatibility with the decent (rah-rah) shell, even in areas where it would have been easy to keep them compatible. >>>>>>>>>> FLAME OFF <<<<<<<<<<. O.K., so I'm a bigot too (I was raised on V6/V7 shells, and I'm lazy), but the points made above are STILL valid. I just thing csh is a waste of time. Never afraid to show my true colours, Dave Lukes.