Re: Summary: Formatting question
Re: Summary: Formatting question
- Subject: Re: Summary: Formatting question
- From: "Mark J. Reed" <email@hidden>
- Date: Fri, 20 Apr 2007 16:03:59 -0400
On 4/20/07, Chris Waldrip <email@hidden> wrote:
Mark Reed was kind enough to point out my simple mistake
I was just the first. Lots of kind folks on this list had the answer...
do shell script "scutil --set ComputerName \"" & machineName & "\""
with administrator privileges
Instead of doing your own manual quoting with \" in the strings, I'd
replace { machineName } with { quoted form of machineName }, which
puts the whole thing in single quotes (so any accidental shell
metacharacters don't get expanded) and also handles anything like
embedded quotation marks (such as an apostrophe-s in a filename, for
instance).
Of course, none of this is necessary in this case since you just
constructed machineName and know that it's a single word with no
spaces or special characters, so you don't really need any quotation
marks at all. But it's a good general practice when including strings
in do shell scripts.
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden