Since upgrading to OS X 10.5 the TM_USERNAME variable used in bundles has been unset.
The following command is the problem:
TM_USERNAME=`niutil -readprop / /users/$USER realname`
Seems that the niutil command has been dropped from 10.5 onwards and replaced by the dscl command.
The following gets the current users real name but prepends it with the property key:
dscl . -read /Users/$USER RealName
returns: RealName: John Hunter
I'm not sure how you get the value without the key.
Has anyone got a solution to this? It affects most of the templates.
Apologies if its been covered before.
Thanks --John
This could be a possible solution ...
dscl . -read /Users/$USER RealName |sed -e "s/RealName://" -e "s/^ \ //" | tail -1
On Nov 29, 2007, at 7:20 AM, John Hunter wrote:
Since upgrading to OS X 10.5 the TM_USERNAME variable used in bundles has been unset.
The following command is the problem:
TM_USERNAME=`niutil -readprop / /users/$USER realname`
Seems that the niutil command has been dropped from 10.5 onwards and replaced by the dscl command.
The following gets the current users real name but prepends it with the property key:
dscl . -read /Users/$USER RealName
returns: RealName: John Hunter
I'm not sure how you get the value without the key.
Has anyone got a solution to this? It affects most of the templates.
Apologies if its been covered before.
Thanks --John
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On 29/11/2007, Kai Janson kaijanson@thejeeper.net wrote:
dscl . -read /Users/$USER RealName |sed -e "s/RealName://" -e "s/^ \ //" | tail -1
I don't understand why that can't just be
dscl . -read /Users/$USER RealName |sed 's/RealName: //'
?
Or an alternative approach:
perl -le 'print +(getpwuid $<)[6]'
Robin
There is a leading whitespace
On Nov 29, 2007, at 8:14 AM, Robin Houston wrote:
On 29/11/2007, Kai Janson kaijanson@thejeeper.net wrote:
dscl . -read /Users/$USER RealName |sed -e "s/RealName://" -e "s/^ \ //" | tail -1
I don't understand why that can't just be
dscl . -read /Users/$USER RealName |sed 's/RealName: //'
?
Or an alternative approach:
perl -le 'print +(getpwuid $<)[6]'
Robin
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Are you sure? There isn't one on my computer; though I'm still running 10.4, so it could be different.
(You noticed that I added a space after the colon in the regular expression?)
Robin
On 29/11/2007, Kai Janson kaijanson@thejeeper.net wrote:
There is a leading whitespace
On Nov 29, 2007, at 8:14 AM, Robin Houston wrote:
On 29/11/2007, Kai Janson kaijanson@thejeeper.net wrote:
dscl . -read /Users/$USER RealName |sed -e "s/RealName://" -e "s/^ \ //" | tail -1
I don't understand why that can't just be
dscl . -read /Users/$USER RealName |sed 's/RealName: //'
?
Or an alternative approach:
perl -le 'print +(getpwuid $<)[6]'
Robin
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Yes, I am running Leopard 10.5.1 and there is actually a white space in front of the name. I assume that your dscl . -read /Users/$USER RealName |sed 's/ RealName: //' works on Tiger but it does not work on Leopard.
There is no trailing white space on Leopard, thus it fails to sed anything. The technique I use is overkill. I could have used
dscl . -read /Users/$USER RealName | tail -1
but then I would end up with the name plus a leading white space.
dscl . -read /Users/$USER RealName | tail -1 | sed -e "s/^\ //"
That line fishes the real name out of dscl's database, then eliminates the first line altogether and finally removes the leading white space if there is one.
Here a snippet from my shell:
mac-mini-intel:Tasks kjanson$ res=`dscl . -read /Users/$USER RealName | tail -1` mac-mini-intel:Tasks kjanson$ echo "'$res'" ' Kai Janson' mac-mini-intel:Tasks kjanson$ res=`dscl . -read /Users/$USER RealName | tail -1 | sed -e "s/^\ //"` mac-mini-intel:Tasks kjanson$ echo "'$res'" 'Kai Janson'
--Kai
On Nov 29, 2007, at 10:58 AM, Robin Houston wrote:
Are you sure? There isn't one on my computer; though I'm still running 10.4, so it could be different.
(You noticed that I added a space after the colon in the regular expression?)
Robin
On 29/11/2007, Kai Janson kaijanson@thejeeper.net wrote:
There is a leading whitespace
On Nov 29, 2007, at 8:14 AM, Robin Houston wrote:
On 29/11/2007, Kai Janson kaijanson@thejeeper.net wrote:
dscl . -read /Users/$USER RealName |sed -e "s/RealName://" -e "s/^ \ //" | tail -1
I don't understand why that can't just be
dscl . -read /Users/$USER RealName |sed 's/RealName: //'
?
Or an alternative approach:
perl -le 'print +(getpwuid $<)[6]'
Robin
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On 29/11/2007, Kai Janson kaijanson@thejeeper.net wrote:
Yes, I am running Leopard 10.5.1 and there is actually a white space in front of the name.
Wow, that's awful. Thanks. Why is it that Apple are so dreadful at making command-line tools that work in a sensible way?
If we need to do this (and Peter's comment is making me wonder whether or not we do), then at least
perl -le 'print +(getpwuid $<)[6]'
is portable and concise (and not likely to break when Apple change their bizarre tool in yet another incompatible way).
Robin
Excerpts from Robin Houston's message of Thu Nov 29 13:19:21 -0500 2007:
perl -le 'print +(getpwuid $<)[6]'
is portable and concise (and not likely to break when Apple change their bizarre tool in yet another incompatible way).
There's also the slightly longer but slightly clearer Ruby equivalent:
ruby -retc -e 'puts Etc.getpwuid.gecos'
I think it is time for The Fruit to hire UN*X developers. :)
On Nov 29, 2007, at 12:19 PM, Robin Houston wrote:
On 29/11/2007, Kai Janson kaijanson@thejeeper.net wrote:
Yes, I am running Leopard 10.5.1 and there is actually a white space in front of the name.
Wow, that's awful. Thanks. Why is it that Apple are so dreadful at making command-line tools that work in a sensible way?
If we need to do this (and Peter's comment is making me wonder whether or not we do), then at least
perl -le 'print +(getpwuid $<)[6]'
is portable and concise (and not likely to break when Apple change their bizarre tool in yet another incompatible way).
Robin
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On 29 Nov 2007, at 19:19, Robin Houston wrote:
[...] is portable and concise (and not likely to break when Apple change their bizarre tool in yet another incompatible way).
From the r1431 release notes:
[NEW] TextMate sets TM_FULLNAME (unless you set it yourself) to the user’s full name, so no longer necessarily to fiddle with niutil and dscl to obtain it.
So it should not be necessary for commands/snippets to try and obtain the full username themselves.
I believe TM_USERNAME has been replaced with TM_FULLNAME to better conform with variables in XCode or something. nutil is gone with Leopard.
ph
On Nov 29, 2007, at 2:20 PM, John Hunter wrote:
Since upgrading to OS X 10.5 the TM_USERNAME variable used in bundles has been unset.
The following command is the problem:
TM_USERNAME=`niutil -readprop / /users/$USER realname`
Seems that the niutil command has been dropped from 10.5 onwards and replaced by the dscl command.
The following gets the current users real name but prepends it with the property key:
dscl . -read /Users/$USER RealName
returns: RealName: John Hunter
I'm not sure how you get the value without the key.
Has anyone got a solution to this? It affects most of the templates.
Apologies if its been covered before.
Thanks --John
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate