Replace # with a 1 or 0 depending on what behavior you would like
#!/bin/bash
/usr/bin/defaults write /Library/Preferences/com.apple.loginwindow SHOWFULLNAME #
A defaults command will work, but why not use a Config Profile for this? It's part of the standard Login Window payload options.

Edit: Sorry, I didn't even see you specifically said you wanted to stay away from a profile. I'm curious on why though.
@mm2270
My guess would be that, if the setting is applied with the config profile, a user cannot go back and modify it later.
That is true, but most times that's a setting that admins don't want end users changing, which is why a config profile is usually ideal for it. Username/password is a bit more secure than just List of users since half the secret to logging in is already showing in the latter configuration.
I don't prefer Config Profiles so there aren't too many in the Profiles list, and because i dont want to set a bunch of settings in one CP that could conflict with another. I'd rather go with more granular controls than having other misc settings configured in a CP.
Some other great things you can do at the log in window:
https://twocanoes.com/12-customizations-for-the-mojave-macos-login-window-that-you-didnt-know-about/
@casafrancisco
Two things..
Vote this up...
https://www.jamf.com/jamf-nation/feature-requests/6281/break-up-multi-mdm-payload-gui-payloads
Please!!
And
You can create profiles that only have one key, I think this is one of the common tools
https://github.com/ProfileCreator/ProfileCreator
I usually start with a Jamf or macOS server profile, unsign it edit it and then resign it with Apple Configurator.
C
@gachowski i have upvoted that request already
Thanks i'll check out that ProfileCreator sometime!