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

  1. --- a/usr/lib/byobu/whoami
  2. +++ b/usr/lib/byobu/whoami
  3. @@ -19,12 +19,28 @@
  4. # You should have received a copy of the GNU General Public License
  5. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  6. +___get_user() {
  7. + if eval $BYOBU_TEST whoami >/dev/null 2>&1; then
  8. + whoami
  9. + elif eval $BYOBU_TEST id >/dev/null 2>&1; then
  10. + id -un
  11. + fi
  12. +}
  13. +
  14. __whoami_detail() {
  15. - getent -- passwd "$USER"
  16. + local user=$(___get_user)
  17. + [ -n "$user" ] || return
  18. + if eval $BYOBU_TEST getent >/dev/null 2>&1; then
  19. + getent -- passwd "$user"
  20. + else
  21. + grep "^$user:" /etc/passwd
  22. + fi
  23. }
  24. __whoami() {
  25. - color bold2; printf "%s@" "$(whoami)"; color -
  26. + local user=$(___get_user)
  27. + [ -n "$user" ] || return
  28. + color bold2; printf "%s@" "$user"; color -
  29. }
  30. # vi: syntax=sh ts=4 noexpandtab