File: originator.sh

package info (click to toggle)
eso-midas 23.02pl1.0-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 146,968 kB
  • sloc: ansic: 360,674; makefile: 6,231; sh: 6,003; pascal: 535; perl: 40; awk: 36; sed: 14
file content (31 lines) | stat: -rw-r--r-- 928 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
# @(#)originator.sh	19.1 (ESO-IPG) 02/25/03 14:32:00
# Copyright (C) 1993 Free Software Foundation, Inc.

[ -z "$TMPDIR" ] && TMPDIR=/tmp
TEMP=$TMPDIR/p$$

# Find out the name of the originator of this PR.
if [ -n "$NAME" ]; then
  ORIGINATOR="$NAME"
elif [ -f $HOME/.fullname ]; then
  ORIGINATOR="`sed -e '1q' $HOME/.fullname`"
else 
  grep "^$LOGNAME:" /etc/passwd | cut -f5 -d':' | sed -e 's/,.*//' > $TEMP
  ORIGINATOR="`cat $TEMP`"
  rm -f $TEMP
fi

if [ "$ORIGINATOR" = "" -a -f /bin/domainname ]; then
  if [ "`/bin/domainname`" != "" -a -f /usr/bin/ypcat ]; then
    # Must use temp file due to incompatibilities in quoting behavior
    # and to protect shell metacharacters in the expansion of $LOGNAME
    /usr/bin/ypcat passwd 2>/dev/null | cat - /etc/passwd | grep "^$LOGNAME:" |
      cut -f5 -d':' | sed -e 's/,.*//' > $TEMP
    ORIGINATOR="`cat $TEMP`"
    rm -f $TEMP
  fi
fi

echo $ORIGINATOR
exit 0