![](/img/trans.png)
[英]In Itext7, how can i go through a string and see if my current font can display the string correctly?
[英]AppleScript - How can I get this string to properly go through?
set UserName to do shell script "whoami"
set AD to do shell script ("dscl "/Active Directory/YC/All Domains/" read /Users/" & UserName)
我的錯誤:應為“,”,但找到標識符
所以我試圖在活動目錄中找到一個用戶 SMBHome,因為我們基於它映射了我們的驅動器。 但該命令的問題是雙字符串。 "/Active Directory/YC/All Domains/" 有一個字符串,否則它不會正確排隊。
但是要執行shell腳本(“COMMAND HERE”)也必須是一個字符串..
我該如何解決這個問題?
有沒有更簡單的方法來做到這一點?
完整腳本:
set UserName to do shell script "whoami"
set AD to do shell script ("dscl "/Active Directory/YC/All Domains/" read /Users/" & UserName)
if AD contains "StaffShare" then
set SMBHome to "smb://domain/StaffShare"
else
set SMBHome to "smb://domain/EmployeeShare"
end if
set mounted_disk to list disk
mount volume SMBHome as user name UserName
沒關系,我真的想通了。 類似於 Lua "dscl \\"/Active Directory/YC/All Domains/\\" read /Users/" & UserName
雖然我仍然想看看是否有人對此有更好的解決方案。 :)
您可以使用單引號:
set AD to do shell script "dscl '/Active Directory/YC/All Domains/' read $HOME"
但是你這樣做的方式,通過轉義雙引號,它完全合法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.