For the launchctl terminal command I need to get the id of the logged in user. A
id -u username
does that. But which username should I use? My main computer has the users “Beatrix Willius” and “Beatrix_Willius”. The first one has a short username of beatrixwillius. The secone one is beatrixwillius 1 or beatrixwillius\ 1 when using “echo $HOME”.
I’ve been doing some tests in the Terminal:
Trixis-iMac:~ beatrix_willius$ id -u beatrixwillius\ 1
id: beatrixwillius 1: no such user
Trixis-iMac:~ beatrix_willius$ id -u beatrixwillius 1
501
Trixis-iMac:~ beatrix_willius$ id -u beatrix_willius
502
Trixis-iMac:~ beatrix_willius$ id -u 'beatrixwillius 1'
id: beatrixwillius 1: no such user
“beatrixwillius\ 1” doesn’t work. “beatrixwillius 1” gets the “Beatrix Willius” user and not “Beatrix_Willius” with the underscore.
beatrix_willius gets the correct user. There I got the username with SystemInformationMBS.ShortUsername and not “echo $HOME”. Is the ShortUsername safe to use?