diff options
author | H.Merijn Brand <h.m.brand@xs4all.nl> | 2016-12-09 15:19:36 +0100 |
---|---|---|
committer | Raphael Manfredi <Raphael_Manfredi@pobox.com> | 2016-12-09 15:19:36 +0100 |
commit | 9f910d66c936dfdff953e212376f1943af479509 (patch) | |
tree | 831d62b6922a1a6798c77b572834e995de4a417d /mcon | |
parent | 553404ab9739b1f4114f0e8f1a9382c279ae76a8 (diff) |
If cf_by is empty, try logname before whoami (#7)
Diffstat (limited to 'mcon')
-rw-r--r-- | mcon/U/cf_who.U | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/mcon/U/cf_who.U b/mcon/U/cf_who.U index d89b1d4..d7492c7 100644 --- a/mcon/U/cf_who.U +++ b/mcon/U/cf_who.U @@ -47,16 +47,19 @@ cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1` ?X: cf_by=`( (logname) 2>/dev/null || whoami) 2>&1` ?X: Switch to emergency mode... -- RAM, 19/04/94 ?X: -?X: Parens needed to avoid error message if the program does not exist. +?X: Parentheses needed to avoid error message if the program does not exist. ?X: Uses case instead of $test so it can be put before $test is defined. ?X: Don't redirect to a file because on Ultrix (under script?) logname ?X: outputs a blank line first. This method will apparently work. -cf_by=`(logname) 2>/dev/null` case "$cf_by" in "") - cf_by=`(whoami) 2>/dev/null` + cf_by=`(logname) 2>/dev/null` case "$cf_by" in - "") cf_by=unknown ;; + "") + cf_by=`(whoami) 2>/dev/null` + case "$cf_by" in + "") cf_by=unknown ;; + esac ;; esac ;; esac |