The Hamilton C Shell
Total Page:16
File Type:pdf, Size:1020Kb
The Hamilton Cshell perform frequently. On the other hand, it PRODUCT INFORMATION A command-line interface may be complex, its function and behavior based partly on command-line arguments, for OS/2 that borrows the environment, and user interaction. Hamilton C shell 1.03 A shell procedure may even be recur Hamilton Laboratories the power of Unix sive. For instance, I wrote a recursive 13 Old Farm Rd. Wayland, MA 01778-3117 procedure called "dirt" that pretty-prints (508) 358-5715 a directory tree using indentation to indi $350; requires IBM AT, PS/2, or compat cate common parentage. When called with ible; OS/2 1.1 with Presentation BY KENNETH G. GOUTAL no arguments, it prints the directory tree Manager from your current working directory on Inquiry 71 he Hamilton C shell is an implemen down. When called with one argument, it T tation under OS/2 version 1.1 of the prints the directory tree from the speci Unix C shell. The C shell is a command fied directory on down. When it calls This product appears to work perfectly line interpreter with commands for run itself recursively, it passes a subdirectory and exactly as described in the manual. It ning programs, spawning threads and and the current indentation as arguments. also works blindingly fast, for two rea processes, and manipulating directories Several commands can be "stacked" sons. First, it compiles commands and pro and files. It also has high-level program on a single command line. For instance, cedures before executing them, rather than ming constructs that allow you to exe slavishly interpreting them. Second, it cute those commands in other than cat * .txt >alltxt; we-w makes use of the OS/2 threads whenever simple sequential order. alltxt the Unix C shell would use processes. Users who are used to working with I did encounter some installation diffi Unix but are totally unfamiliar with OS/2 mncatenates all the files with the ex culties. This was due partly to my unfa will find that this tool eases the transition tension ". txt" into a file called "alltxt." It miliarity with OS/2, partly to some lack of greatly. With a couple of minor excep then counts the words in that file. clarity in the manual, and partly to the tions, the Hamilton C shell is an exact Commands can be "piped" together lack of a program to supervise the instal functional duplicate of the C shell found with a single command. For example, lation. It was not due to any bugs in the on Unix systems. The few exceptions are software or errors in the manual. clearly documented and are mostly a mat eat * . txt I we -w Hamilton Laboratories reports that, to ter of cleaning up ugly irregularities in date, it has a 24-hour turnaround time for the traditional C shell or adaptirVg to the does the same thing as the previous ex fixing serious bugs, with updates sent out OS/2 environment itself. ample, but without the need for an inter the next day. Based on the company's For example, the character used by mediate file. The output of the first com responsiveness when I called with some OS/2 to punctuate path names is the back mand is fed directly into the next. questions about installation, I'm inclined slash rather than the forward slash used A "history" mechanism makes short to believe this. The fixes to less serious by Unix. This precludes the use of the work of retyping commands either to cor bugs are included in subsequent releases. backslash to mean "take the next charac rect an error in the command just typed The company can be reached by phone, ter literally, and ignore any special mean or to reuse a complicated command is mail, or electronic mail. ing it usually has in the Unix C shell." sued several minutes or even hours be In conclusion, it looks like we have a OS/2 normally uses the caret for this pur fore. For example, ! eat reexecutes the winner. I expected to be put off by OS/2, pose, so the Hamilton C shell follows entire command line in the previous ex but after I got the Hamilton C shell in suit. As a result, the caret cannot be used ample; ! ! : s / t xt / 1 og does this again, stalled and tailored to my tastes, it was for short-form history substitution as it is except that it counts the words in all the just like being back home. I had some on the Unix C shell, and the percent sign files with the extension ".log" instead of difficulties at first adapting to the minor is used instead. However, these choices ". txt." ! 23 reexecutes the 23rd command incompatibilities with the Unix C shell, are controlled by environment variables, you had typed since starting the current but after that it was smooth sailing. I so if you really must use the characters copy of the Hamilton C shell. expect that someone who is not used to you're used to, you can. The Hamilton C shell provides several using the Unix C shell would actually OS/2 users who have never seen Unix useful utility programs as well as several have an easier time with the Hamilton C will benefit from the Hamilton C shell's built-in commands. The most common shell than with the Unix C shell. Natu interface, which is much more powerful Unix commands are proVided either as rally, it will take a while to learn how to than the CMD.EXE supplied with OS/2. built-in commands or as external utilities: exploit all of its power, but its features Control constructs include s w.i. L eh, rotd, sleep, SOULee, cat, ehmod, can be used independently and learned un til, and whi 1 e. Contrary to whatthe ep, date, du, Is, mkdir, more, only when necessary. There are some product name suggests, the syntax of these mY, pwd, rm, rmdir, tee, touch, improvements that could be made in the constructs is not much like that of the C and we. Others, such as awk, grep, and area of installation and in the manual, but programming language. It is, however, sed, are on the way. Some of these do the these are not prohibitive and may have faithful to the Unix C shell syntax. same things as commands in CMD.EXE, already been made by the time you read You can store a sequence of commands, some do the same things as other utilities this. All in all, the Hamilton C shell is a called a shell script, in a file and execute supplied with OS/2, while others have no much-needed and well-done product. _ the sequence with the souree command. OS/2 equivalent. For convenience, many You can also define shell procedures, common CMD.EXE commands and OS/2 which are stored within the shell itself utility names have been defined as ali Kenn Goutal is a technical support engineer at until you exit from it. A procedure may ases of the built-in commands and of the Interhase Software Corp. o/Bedjord, MA. He be a simple series of commands that you utilities included with the shell. can he reached via II11Gp as [email protected]. Reprinted with permission of MIPS Magazine © Copyright SEPTEMBER 1989 1989 by Computer Metrics, Inc. All rights reserved. MIPS .