使用通配符匹配 bash 中的目录

2 bash directory wildcards

可以说文件夹结构是这样的:

/home/
--user1/asdf
--user2/asdf1234
--user3/asdf325234
--cool/asdf
Run Code Online (Sandbox Code Playgroud)

如何在不指定用户的情况下更改为 asdf1234?例如:

cd /home/*/asdf1234
Run Code Online (Sandbox Code Playgroud)

如何在 bash 中使用“not”?例如,假设我想去/home/cool但不使用功能:

cd /home/!user*/asdf 这可能吗?

这些 bash 技巧可能吗?

aec*_*ley 6

打开extglob外壳选项,然后cd /home/!(user*)/asdf