Check-in Number:
|
3294 | |
Date: |
2003-Feb-22 13:27:20 (local)
2003-Feb-22 12:27:20 (UTC) |
User: | rse |
Branch: | |
Comment: |
Enhance %u, %U, %g and %G expansions of "shtool echo -e"
by also trying the Solaris/Linux "getent" command.
Hint by: Christoph Schug <chris@schug.net> |
Tickets: |
|
Inspections: |
|
Files: |
|
ossp-pkg/shtool/ChangeLog 1.182 -> 1.183
--- ChangeLog 2003/02/21 19:18:34 1.182
+++ ChangeLog 2003/02/22 12:27:20 1.183
@@ -12,6 +12,11 @@
Changes between 1.6.2 and 2.0b0 (02-Nov-2002 to xx-Feb-2003):
*) Enhance %u, %U, %g and %G expansions of "shtool echo -e"
+ by also trying the Solaris/Linux "getent" command.
+ [Ralf S. Engelschall <rse@engelschall.com>,
+ Christoph Schug <chris@schug.net>]
+
+ *) Enhance %u, %U, %g and %G expansions of "shtool echo -e"
by first trying to resolve via POSIX "id" command.
[Ralf S. Engelschall <rse@engelschall.com>,
Bill Campbell <bill@celestial.com>]
|
|
ossp-pkg/shtool/sh.echo 1.34 -> 1.35
--- sh.echo 2003/02/21 19:18:34 1.34
+++ sh.echo 2003/02/22 12:27:20 1.35
@@ -141,14 +141,18 @@
userid=`echo $str | sed -e 's/^uid[ ]*=[ ]*//' -e 's/(.*$//'`
fi
if [ ".$userid" = . ]; then
- userid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
+ userid=`(getent passwd ${username}) 2>/dev/null | \
sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$userid" = . ]; then
- userid=`(ypcat passwd) 2>/dev/null |
- egrep "^${username}:" | \
+ userid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$userid" = . ]; then
- userid='?'
+ userid=`(ypcat passwd) 2>/dev/null |
+ egrep "^${username}:" | \
+ sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
+ if [ ".$userid" = . ]; then
+ userid='?'
+ fi
fi
fi
fi
@@ -166,13 +170,17 @@
groupid=`echo $str | sed -e 's/^.*gid[ ]*=[ ]*//' -e 's/(.*$//'`
fi
if [ ".$groupid" = . ]; then
- groupid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
+ groupid=`(getent passwd ${username}) 2>/dev/null | \
sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$groupid" = . ]; then
- groupid=`(ypcat passwd) 2>/dev/null | egrep "^${username}:" | \
+ groupid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$groupid" = . ]; then
- groupid='?'
+ groupid=`(ypcat passwd) 2>/dev/null | egrep "^${username}:" | \
+ sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
+ if [ ".$groupid" = . ]; then
+ groupid='?'
+ fi
fi
fi
fi
@@ -189,14 +197,19 @@
groupname=`echo $str | sed -e 's/^.*gid[ ]*=[ ]*[0-9]*(//' -e 's/).*$//'`
fi
if [ ".$groupname" = . ]; then
- groupname=`egrep "^[^:]*:[^:]*:${groupid}:" /etc/group 2>/dev/null | \
+ groupname=`(getent group) 2>/dev/null | \
+ egrep "^[^:]*:[^:]*:${groupid}:" | \
sed -e 's/:.*$//'`
if [ ".$groupname" = . ]; then
- groupname=`(ypcat group) 2>/dev/null | \
- egrep "^[^:]*:[^:]*:${groupid}:" | \
+ groupname=`egrep "^[^:]*:[^:]*:${groupid}:" /etc/group 2>/dev/null | \
sed -e 's/:.*$//'`
if [ ".$groupname" = . ]; then
- groupname='?'
+ groupname=`(ypcat group) 2>/dev/null | \
+ egrep "^[^:]*:[^:]*:${groupid}:" | \
+ sed -e 's/:.*$//'`
+ if [ ".$groupname" = . ]; then
+ groupname='?'
+ fi
fi
fi
fi
|
|