![]() |
commands to retrieve computer name
FWIW, i pieced together this script to quickly run through all [eight!] possibilities, so we can quickly compare their various outputs. I even added another approach that uses AppleScript (via osascript). So far, i think scutil seems the simplest. Before you discount the PlistBuddy method, it's the only one that works in [raw] single-user mode... though i'm not sure there's much use for knowing the computer name there.
Code:
#!/bin/bash - |
Hal-
You forgot a method, there is also a switch in the systemsetup command to get and set the computer name. |
Well personally being a bit "old school" and a long time Unix head I'd use this...
uname -n | awk -F. '{ print $1 }' :D |
Hmm, interesting and weird: it pops up a *GUI* dialog requesting a password!!! :eek:
Think i'll skip that one. (it appears to be networksetup's little brother anyway). |
Must be some OSA script:
Code:
osascript -e 'computer name of (system info)' |
I don't understand what's going on here. I visited this thread several times since posting my 12-12-2009, 03:08 PM reply (post #24) to tlarkin. The post by Shardy was never here then (so in fact, my post was actually numbered #23 when i replied back in Dec.). And it remained so for a while when i checked back. [i.e., no Shardy post.]
Now both Shardy and renaultssoftware are repeating stuff already contained in my post #21. It's almost as if they (at times) can't see my posts and i (at times) can't see theirs. Maybe it's that thing where new member posts don't display until they're approved? If so, that would be *my* excuse then. |
Perhaps the Mods merged two threads.
|
Hal, I just now saw your post after visiting this thread several times.
|
| All times are GMT -5. The time now is 10:19 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.