beginner using script

juicedaninja
New Contributor

Hello everyone,

I just want to ask question.

mounting network drive using script through terminal.

let say I want to mount a network drive named "\jamfsoftwaresoftware est"

how to I mount that using a script?

when you use "connect to server", they automatically connects to network drive and shows the content of the network drive.

example, using smb://jamfsoftware/software/test to connect.

I just want to make same thing happening using script.

I tried searching through internet, but I couldn't find good coding for it.

Could you guys let me know how if possible?

Thank you

6 REPLIES 6

AVmcclint
Honored Contributor

I use

open 'smb://server.company.com/share'

and it seems to work ok.

roiegat
Contributor III

First you need to create a directory for it:

mdkir /tmp/test

then mount it

mount -t smbfs //user:pass@jamfsoftware/software/test /tmp/test

This mounts it to the tmp/test folder

spotter
New Contributor III

you can try something like this...

#!/bin/sh
mountShare=`/usr/bin/osascript  > /dev/null << EOT
tell application "Finder"
activate
mount volume "smb://jamfsoftware/software/test"
end tell
EOT`

bentoms
Esteemed Contributor
Esteemed Contributor

I do something similar to what @spotter posted.

Write up here.

Look
Valued Contributor III

Likwise I use something similar to @spotter as well, getting the Finder to do it removes a lot of the complications especially if your running as root or different user from a script or policy.

juicedaninja
New Contributor

i'm just trying to get part of it working using different ways of doing this.

I made Alias folder (network folder) to desktop.

when I try to access the folder using CD, it said "no such file or directory"

is there way I could access network folder through terminal?

when I do LS command, it shows up in the list, but when I actually try to go, it doesn't....

i'm trying to copy data from network drive to desktop using terminal commands *