home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.24 / text0060.txt < prev    next >
Encoding:
Text File  |  1991-09-03  |  1.6 KB  |  38 lines

  1. Submitted-by: addw@phcomp.co.uk (Alain Williams)
  2.  
  3. > >A puzzle for the reader (maybe this is obvious to everyone but
  4. > >me):  How can a shell script determine whether it's running on
  5. > >a POSIX.2 system?  If it calls getconf and getconf does not
  6. > >exist, the shell may exit.  It could call getconf in a
  7. > >subshell, but that's ugly and expensive.
  8. > I don't know what POSIX says, but I'd expect an analog to POSIX.1 -
  9. > an environment variable telling which version of POSIX we are.
  10. > POSIX.1 does the same with #define.
  11. Yuck! There is too much in the environment already, and anyway it is far
  12. too easily changed (accidentally or otherwise).
  13.  
  14. What is really wanted is something which can be easily put onto systems, both
  15. new and existing. One of the problems is "OK we invent a way of doing it,
  16. but there are still many systems out there which won't have it/do it". Have
  17. you tried writing a portable program in ansi C ? We have to live with the
  18. old ones for a while.
  19.  
  20. The old machines had commands like `vax' and `pdp11'. That was never really
  21. developed/continued (sigh).
  22.  
  23. OK, use getconf, but what if it doesn't exist. Well, you could use my `path'
  24. program to find out if it exists. It is a (Bourne) shell script, so portable
  25. and not very long. I will post it to this list if you think that it would
  26. be useful. I use it quite a lot for all sorts of things, eg:
  27.     size `path emacs vi`
  28. and it can be illuminating to try:
  29.     path -a some_command
  30.  
  31. Alain Williams
  32. +44 734 461232
  33. phLOGIN our Turnkey Security Login utility is available NOW - ask me for info.
  34.  
  35. Volume-Number: Volume 24, Number 61
  36.  
  37.