Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Simple apple script - Beginner Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple apple script - Beginner Problem



At 14:56 +0100 7/14/09, James Bensley wrote:
>set UNC to (do shell script "/usr/bin/dscl localhost read /Active\\
>Directory/All\\ Domains/Users/" & user_name & " homeDirectory | awk -F
>\":\" '{print $3}' | cut -c 4-200")
>
>Which works a treat except for one thing; with the UNC path returned
>the slashes are the wrong way around, i.e the UNC path returned
>contains back slashes but it needs to be forward slashes for the mount
>command to correctly interpret the input;

I had the same problems until quoted form of arrived.

You need three backslashes in places. Applescript applies them first and then the bash shell does its thing after execution through a kernel execve command.  I don't claim to understand it and perhaps it's just wrong and "quoted form of" is designed to repair the damage.

Try using quoted from of, that's an AppleScript command in three words, to get something you can return as text for viewing.

set havealook to quoted form of ( " homeDirectory | awk 'BEGIN{FS=\":\"};{print $3}'")
havealook

do shell script "dscl"  & space &  havealook

The rest of your command line is not all that clear to me especially in the awk part.  Those single quotes likely need special quoting too.
--

--> A fair tax is one that you pay but I don't <--
 _______________________________________________
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

References: 
 >Simple apple script - Beginner Problem (From: James Bensley <email@hidden>)
 >Re: Simple apple script - Beginner Problem (From: James Bensley <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.