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.
我sshfs用来将远程驱动器安装到我的文件系统上。但是,每当我卸载它时,它都会删除创建它的文件夹。我的第一个问题是删除文件夹的目的是什么。其次,有没有办法在给定目录不存在的情况下sshfs为要执行的命令设置别名mkdir- 这样我就不需要在每次想挂载驱动器时都创建一个?我使用 bash 作为我的默认 shell。
sshfs
mkdir
您可以使用以下命令测试 bash 中是否存在文件夹
[ -d "/path/to/the/folder" ]
否定是
[ ! -d "/path/to/the/folder" ]
因此,测试 / 使目录的别名如下所示:
alias test='if [ ! -d "/path/to/the/folder" ]; then mkdir -p "/path/to/the/folder"; fi'
只需将上述部分添加到您的sshfs别名中即可。