From PinkPosixPXE, 4 Years ago, written in Bash.
  1.  
  2. ### Add to the bottom of .bash_profile ###
  3. ### Username function that prompts the user for a real name ###
  4. username(){
  5. echo "Please enter your full name:"
  6. read username
  7. username="${username}"
  8. if [[ -z "${username}" ]]; then
  9.         username
  10. else
  11.         echo "Name: \"${username}\" - You are now logged in as \"${USER}\""
  12.         logger -p authpriv.info "(SSH Auth Name): Name: \"${username}\" logged in as User: \"${USER}\" "
  13.         history -s "[Name: ${username}] $(date +"%F %T")"
  14. fi
  15. }
  16.  
  17. ## Only run "Username logger" if shell is interactive ##
  18. case "$-" in
  19. *i*)    username ;;
  20. esac
captcha