Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Linux 中,是否可以通过 bash 脚本获取“/dev/sr0”并确定它安装到哪个文件夹并对所述文件夹执行额外操作?
您可以使用该命令mount(8)查找安装了哪些设备。在 Linux 上,此信息可在/proc/mounts文件中找到。
mount(8)
/proc/mounts
您可以通过以下命令输出目录名称:
grep /dev/sr0 /etc/mtab | cut "-d " -f2
或在像这样的其他命令中使用它(例如列出其内容):
ls $(grep /dev/sr0 /etc/mtab | cut "-d " -f2)