在 中bash,假设我想链接目录中的一些但不是所有文件,例如,
ln -s /dir/file1 /dir/file2 ... /other/dir
Run Code Online (Sandbox Code Playgroud)
但是文件名的格式不遵循一些简单的规则,所以我们不能使用类似
ln -s /dir/file* /target/dir.
Run Code Online (Sandbox Code Playgroud)
无论如何不要重复/dir,例如:
/dir/{file1 file2 ...} = /dir/file1 /dir/file2 ...
Run Code Online (Sandbox Code Playgroud)
所以我们可以做这样的事情:
ln -s /dir/{file1 file2 ...} /target/dir
Run Code Online (Sandbox Code Playgroud)