Munki-Enroll is a great little script combo that automatically changes the ClientIdentifier for Munki clients and then automatically creates a corresponding manifest on the Munki server that includes the old manifest.
I wanted to tweak it quite a bit to fit some of the quirks of how our organization does Munki client manifests, so I wrote up a tweaked version of the enroll shell script.
One of the things I wanted to get via the script is a particular user’s full name, and I had trouble tracking down a tutorial on exactly how to get that. I also found that even when I used the usual instructions, on one computer, it didn’t work—there was an extra carriage return before the full name… but that wasn’t the case on other computers (and it wasn’t a Yosemite vs. El Capitan thing either).
So this command actually gets the user’s full name even if there’s a random extra newline in the output. This works on both Yosemite and El Capitan (and probably earlier versions, but I haven’t tested on Mavericks and before):
Basically, this read’s the user’s information, specifically the RealName. Then it strips out the RealName: part, then strips out any newline indicators, then finally strips out any preceding or trailing spaces.
Not sure if anyone else out there is looking for how to get the full name of a user using the terminal on a Mac, but that’s how you do it.