You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

33 lines
802 B

--- a/usr/lib/byobu/whoami
+++ b/usr/lib/byobu/whoami
@@ -19,12 +19,28 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+___get_user() {
+ if eval $BYOBU_TEST whoami >/dev/null 2>&1; then
+ whoami
+ elif eval $BYOBU_TEST id >/dev/null 2>&1; then
+ id -un
+ fi
+}
+
__whoami_detail() {
- getent -- passwd "$USER"
+ local user=$(___get_user)
+ [ -n "$user" ] || return
+ if eval $BYOBU_TEST getent >/dev/null 2>&1; then
+ getent -- passwd "$user"
+ else
+ grep "^$user:" /etc/passwd
+ fi
}
__whoami() {
- color bold2; printf "%s@" "$(whoami)"; color -
+ local user=$(___get_user)
+ [ -n "$user" ] || return
+ color bold2; printf "%s@" "$user"; color -
}
# vi: syntax=sh ts=4 noexpandtab