home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!coplex!trebor!root
- From: root@trebor.uucp (Bob Stockler)
- Subject: Re: sh,csh porting guidelines
- Organization: Bob Stockler
- Date: Fri, 06 Nov 1992 23:31:40 GMT
- Message-ID: <1992Nov06.233140.6313@trebor.uucp>
- References: <5728@esf.esf.de>
- Lines: 29
-
- klaus@helsinkiesf.de (Klaus Wicovsky) writes:
-
- >I have just written a little sh script on a Sun. Of course I used things like
- >"echo -n" or "tar xvf tarfile 2> errfile > outfile". When I tried to run it on
- >HP-UX I found that things went wrong/different from what I expected.
-
- >So now my question is: Is there any list of features that are common in almost
- >all Unix (c)sh variations? Is there any kind of document/book that helps ?
-
- First, I would confine my scripts to the Bourne Shell (of which there are
- enough variations), and forget the C Shell for scripts (which it ain't so
- good at anyway).
-
- Second, you might want to look at Larry Wall's "config" program, which
- attempts to find the unique differences on various systems, in order to
- use a Bourne Shell script to help build a header file to compile a program.
- (Or something like that.) He's gone to a lotta effort to cover a lot of
- ground, and looking at what he's done might help you. He tests, for instance
- whether the available "echo" respects the "-n" switch, or requires the "\c"
- convention. You might want to use such tests, or reduce your scripts to the
- lowest common denominator. (I can't tell you where to find "config". Sorry.)
-
- >Tomorrow I might be writing an awk script, will I ever find out on which
- >platforms it will work ?
-
- The problem with "awk" can be solved by using only the very earliest version,
- which ham-strings you a little, or by assuring that "mawk" resides on all the
- systems you'll write for, and then using it.
-
-