tags:

views:

42

answers:

2

Hi, now i am working in porting (i.e solaris to linux)project..i am using one command i.e sun command in solaris ,but i am not able to find equivalent command in linux .if knows anyone please tell me

following is the man page for sun commamd in solaris(i.e man sun)

User Commands machid(1)

NAME machid, sun, iAPX286, i286, i386, i486, i860, pdp11, sparc, u3b, u3b2, u3b5, u3b15, vax, u370 - get processor type truth value

SYNOPSIS sun

 iAPX286

 i386

 pdp11

 sparc

u3b5

 u3b15

 vax

 u370

DESCRIPTION The following commands will return a true value (exit code of 0) if you are using an instruction set that the command name indicates.

 sun             True if you are on a Sun system.



 iAPX286         True if you  are  on  a  computer  using  an
                 iAPX286 processor.



 i386            True if you  are  on  a  computer  using  an

 u370            True if you are on an IBMO  System/370  com-
                 puter.



 The commands that do not apply will  return  a  false  (non-
 zero) value.  These commands are often used within makefiles
 (see make(1S)) and shell scripts  (see  sh(1))  to  increase
 portability.

ATTRIBUTES See attributes(5) for descriptions of the following attri- butes:

 ____________________________________________________________
|       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
|_____________________________|_____________________________|
| Availability                | SUNWcsu                     |
|_____________________________|_____________________________|

SEE ALSO make(1S), sh(1), test(1), true(1), uname(1), attributes(5)

NOTES

SunOS 5.10 Last change: 5 Jul 1990 2

User Commands machid(1)

 The machid family of commands is obsolete. Use uname -p  and
 uname -m instead.

regards, ven

A: 

I can find no mention of the sun command in the Solaris documents (either the user or system administration ones). If you mean the sum command, that should be available, or you probably want to look at cksum.

It's possible your command may be a local one in which case you'll need to tell us what it's supposed to do so we can tell you the alternatives. In terms of figuring it out, you should post:

  • the first bit of output from man sun.
  • the output of which sun.
  • the first 20-odd lines from that file (assuming it's a script rather than binary file).

Following your question update, it looks like you have some code that depends on the sun command return value. That will return true on a Sun and false everywhere else.

So the easiest solution is to probably just create a sun script that returns false:

#!/bin/bash
#
# sun command on non-Sun systems
exit 1

However, it's probably not going to be that simple. Obviously there are some platform-specific things going on there that you will have to add code in for Linux. That doesn't directly affect the sun command but all the stuff that happens when sun returns 0 will have to be done for Linux as well.

If you do a uname -o on Linux, you should get back "Linux" somewhere in the string (from memory). That should be enough to identify the operating system which is probably all you need.

The detection of machine and/or processor is probably not that relevant for software unless you're shipping binary executables for all platforms and selecting which ones to run dynamically.

paxdiablo
A: 

Based on what you've added, I'd say that you can replace sun with false, and check the output of uname -p or uname -m instead.

Ignacio Vazquez-Abrams