* 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]

Reply via email to