bash - 在 Mac 上使用 bash 脚本连接到网络共享?

标签 bash networking mount

我在工作中使用 Mac,希望在启动计算机时安装一些网络共享。我可以使用 bash 脚本(或类似脚本)来连接和挂载这些共享吗?共享来自 Windows 和 Mac 服务器,我们通常使用 IP 地址进行连接。

最佳答案

您可以查看mount_smbfs ,假设您的网络共享是 smbfs/cifs。

mount_smbfs [-N] [-o options] [-d mode] [-f mode] [-h] //[domain;][user[:password]@]server[/share] path

我不太熟悉 OSX 启动过程,但您可以将 shell 脚本创建为/Library/StartupItems 或/System/Library/StartupItems 中的程序/文件夹

osxbook.com 中所述

/etc/rc finally launches /sbin/SystemStarter to handle startup items from locations such as /System/Library/StartupItems and /Library/StartupItems. A StartupItem is a program, usually a shell script, whose name matches the folder name. The folder contains a property list file containing key-value pairs such as Description, Provides, Requires, OrderPreference, start/stop messages etc. You can run SystemStarter -n -D as root to have the program print debugging and dependency information (without actually running anything).

关于bash - 在 Mac 上使用 bash 脚本连接到网络共享?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1142286/

相关文章:

docker - 为什么 docker 有 docker 卷和卷容器

linux - 在KVM VM中挂载共享文件夹错误:mount:unknown filesystem type'9p'

linux - 如何根据原始文件的第一列值组织新文件?

linux - 使用 sed 将单词替换为空白

sockets - 为什么当我在许多 goroutine 中发送一个 tcp shake packet(SYN) 时,我在每个 goroutine 中读取了很多响应包

python - 如何减少通过 REST api 发送的数据的延迟

bash - 有没有办法测试目录内容是否只是因为挂载而存在?

php - bash脚本从ftp服务器获取文件并在下载后重命名文件

linux - 停止在使用 sudo 运行的脚本中间成为 root

Java - 如何知道打印机是否是网络打印机?