Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Escaping an escape (quotes + backslashes)?

25 views
Skip to first unread message

clifh...@gmail.com

unread,
Aug 27, 2012, 6:46:29 PM8/27/12
to
Know this has come before but no prior replies makes any sense to this newbie, AppleScript language section on escape characters does not help, and my head feels like it's going to blow up from trying to visualize escaping escapes. From looks of it, I'm stuck escaping an escape character (?). This is crazy easy in shell, but fails horribly in AS.

Basically just trying to make this:

set domain to "MYDOMAIN"
set admins to "MYADMINS"

do shell script "dsconfigad -groups " & domain & "\"\\ \"" & admins with administrator privileges

equal this:

MYDOMAIN\MYADMINS

The result is instead:

MYDOMAIN\ MYADMINS

What totally obvious and newbie-fail-factor am I missing here?

Cliff

Patrick Stadelmann

unread,
Aug 29, 2012, 3:19:12 AM8/29/12
to
In article <484e977b-5e06-44ef...@googlegroups.com>,
clifh...@gmail.com wrote:

> Know this has come before but no prior replies makes any sense to this
> newbie, AppleScript language section on escape characters does not help, and
> my head feels like it's going to blow up from trying to visualize escaping
> escapes. From looks of it, I'm stuck escaping an escape character (?). This
> is crazy easy in shell, but fails horribly in AS.
>
> Basically just trying to make this:
>
> set domain to "MYDOMAIN"
> set admins to "MYADMINS"
>
> do shell script "dsconfigad -groups " & domain & "\"\\ \"" & admins with
> administrator privileges

You need to pass to the shell \\ (escaped backslash), which in AS is :

[...] domain & "\\\\" & admins [...]

Patrick
--
Patrick Stadelmann <Patrick.S...@unine.ch>
0 new messages