Re: echo $EUID

2002-04-03 Thread Shawn McMahon

begin  quoting what Mark J. Reed said on Tue, Apr 02, 2002 at 11:35:25PM -0500:
 
 In cases where there was an even wider divergence between the
 BSD and System V commands (the ps(1) command being the most infamous
 example), you may find the BSD version in /usr/ucb (this is analogous to
 but reversed from the old SunOS case, where the System V versions were
 in /usr/5bin).

Don't assume, however, that BSD style necessarily is 100% the same
as GNU style.

ps being the example, yet again; the w option doesn't show as much stuff
as you can get with two ws on GNU ps.




msg26577/pgp0.pgp
Description: PGP signature


Re: echo $EUID

2002-04-03 Thread Mark J. Reed

On Wed, Apr 03, 2002 at 08:12:00AM -0500, Shawn McMahon wrote:
 Don't assume, however, that BSD style necessarily is 100% the same
 as GNU style.
 
 ps being the example, yet again; the w option doesn't show as much stuff
 as you can get with two ws on GNU ps.
You can also put two 'w's on /usr/ucb/ps and get the full command line of
every process, but the point is a good one.  The GNU/Linux versions of
commands are neither System V nor BSD, but a separate animal inspired
to various degrees by each of the traditions.

-- 
Mark REED| CNN Internet Technology
1 CNN Center Rm SW0831G  | [EMAIL PROTECTED]
Atlanta, GA 30348  USA   | +1 404 827 4754 
--
Military intelligence is a contradiction in terms.
-- Groucho Marx



Re: echo $EUID

2002-04-03 Thread Shawn McMahon

begin  quoting what Mark J. Reed said on Wed, Apr 03, 2002 at 08:18:57AM -0500:

 You can also put two 'w's on /usr/ucb/ps and get the full command line of
 every process,

Nope; it has a cutoff after a certain number of characters, and there's
nothing you can do about it.

We ran into this problem when one of our developers wrote an application
on Linux that did a ps and looked for a string, when the process in
question was in an extremely long path and was run with the full path
name.  When he ported it to Solaris, it wouldn't work, even with
/usr/ucb/ps, because of the cutoff.

I suggested we install GNU ps, but nobody in management wanted to hear that.




msg26582/pgp0.pgp
Description: PGP signature


Re: echo $EUID

2002-04-03 Thread Tim Kennedy


On Wed, 03 Apr 2002, Shawn McMahon wrote:

 I suggested we install GNU ps, but nobody in management wanted to hear that.
 

I feel blessed.  I have two species of management.  The first kind
wouldn't recognize a server if it reached out and smacked them.
The second species wants to sound like they know what's going on, but
really has no idea what's going on, so when I suggest something, they
say Hrmm.  Let me think about it.  
Then they come back a few hours later and say I think you're on to
something.  Go for it.

we install GNU stuff in /usr/local since Solaris doesn't have anything
in there by default.  Then to each their own, as they set up their
shell.  You have /usr/xpg4/bin, /usr/bin, /usr/local/bin, as you prefer.

Cheers,

-Tim


-- 
He's God. He's flighty. First it's a garden, then there's apples, but you 
can't EAT the apples, and there's a man and a women, but they can't bump 
uglies, and then, ah the hell with it, it's cities and smog and wars and 
shit and he's off resting on the seventh day anyway. --Jeff



msg26589/pgp0.pgp
Description: PGP signature


Re: echo $EUID

2002-04-02 Thread Sven Guckes

* Matthew D. Fuller [EMAIL PROTECTED] [2002-03-27 11:50]:
 .. I end up having to work around Solaris'
 braindamage in a number of ways.
 For instance, on every OTHER OS (including
 pre-Solaris-renaming SunOS, HP/UX 9, NeXT Mach),
 I can use id -u to get the EUID.  Solaris?
 setenv EUID `id | sed s/[a-z\(\)\=]//g | awk '{print $1}'`
 
 Yippie.  Yeah, I could use cut(1) and do
 it a bit more efficiently probably, but...

won't sed suffice?  let's see..

  $ uname -a
  SunOS ritz 5.8 Generic_108528-13 sun4u sparc
  $ id
  uid=10077(guckes) gid=10025(emailer) groups=10025(emailer),10365(hacker),..

so we just need the first number before the first space.
easy:

  $ id | sed -e 's/^uid=\([0-9][0-9]*\).*/\1/'`
  10077

works for me

of course this is much easier with the ZShell:

  $ echo $EUID
  10077

ZShell rules! :-)

Sven

-- 
Sven Guckes [EMAIL PROTECTED]
ZSH HomePage:   http://www.zsh.org
latest version: zsh-4.0.4 [011024]



Re: echo $EUID

2002-04-02 Thread Mark J. Reed

On Wed, Apr 03, 2002 at 05:55:25AM +0200, Sven Guckes wrote:
 * Matthew D. Fuller [EMAIL PROTECTED] [2002-03-27 11:50]:
  .. I end up having to work around Solaris'
  braindamage in a number of ways.
  For instance, on every OTHER OS (including
  pre-Solaris-renaming SunOS, HP/UX 9, NeXT Mach),
  I can use id -u to get the EUID.  Solaris?
/usr/xpg4/bin/id -u

-- 
Mark REED| CNN Internet Technology
1 CNN Center Rm SW0831G  | [EMAIL PROTECTED]
Atlanta, GA 30348  USA   | +1 404 827 4754 
--
186,282 miles per second:
It isn't just a good idea, it's the law!



Re: echo $EUID

2002-04-02 Thread Mark J. Reed

On Tue, Apr 02, 2002 at 11:27:31PM -0500, Mark J. Reed wrote:
 /usr/xpg4/bin/id -u
To expand upon this:

When SunOS becamse Solaris, its base moved from BSD (Berkeley's
UNIX-based OS) to System V (official UNIX from ATT).  
For compatibility with System V applications (and with the POSIX standard),
they had to give all of the standard commands in /bin (or /usr/bin)
the System V semantics.

However, the older behavior was in many cases superior, and those commands
have been retained in /usr/xpg4.  I tend to prefer the XPG version of
most commands, so I have /usr/xpg4 before /usr/bin in my PATH.

In cases where there was an even wider divergence between the
BSD and System V commands (the ps(1) command being the most infamous
example), you may find the BSD version in /usr/ucb (this is analogous to
but reversed from the old SunOS case, where the System V versions were
in /usr/5bin).

Note that not all Solaris installs have these packages; I've found
that more have /usr/xpg4 than /usr/ucb.

-- 
Mark REED| CNN Internet Technology
1 CNN Center Rm SW0831G  | [EMAIL PROTECTED]
Atlanta, GA 30348  USA   | +1 404 827 4754 
--
Now I lay me down to sleep
I pray the double lock will keep;
May no brick through the window break,
And, no one rob me till I awake.