home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / question / 13066 < prev    next >
Encoding:
Text File  |  1992-11-08  |  1.8 KB  |  40 lines

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