Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Mac2013orlater

macrumors member
Original poster
Feb 2, 2014
98
2
The goal is to reproduce Finder's Connect to Server .. in shell script.
Whereby it is a smb share where the connection has to be made to.

I wonder what are all the sub-operations conducted by Connect to Server, because when I write a shell script carrying out as following
- mkdir <mount point>
- chmod bla bla bla, for the mount point dir
- mount <aimed-smb-path>
all I miss is the smb share entry in Finder window which usually is created
by Finder's Connect to Server but not when I run my script.
What does my script miss?
 
You can use the mount volume command from AppleScript's File Commands suite in combination with osascript.

The mount volume command can connect to any file server that is supported by the Finder&#146; &#147;Connect To...&#148; command, including Windows (smb), Samba, and FTP servers. On some kinds of servers, the as user name and with password parameters may not bypass the login dialog, but encoding the name and password in the URL (for example, smb://myname:passwd@server.domain.com/sharename) will mount it silently.

Info : https://developer.apple.com/library/mac/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_cmds.html#//apple_ref/doc/uid/TP40000983-CH216-SW17 - https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/osascript.1.html -
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.