我有一个这样的目录
mkdir test
cd test
touch file{0,1}.txt otherfile{0,1}.txt stuff{0,1}.txt
Run Code Online (Sandbox Code Playgroud)
我想在目录中的某些类型的文件上运行一些命令,例如 ls ,并将 * (glob) 扩展到文件名的所有可能性。
echo 'file otherfile' | tr ' ' '\n' | xargs -I % ls %*.txt
Run Code Online (Sandbox Code Playgroud)
此命令不会扩展 glob 并尝试查找文字“file*.txt”
我如何编写一个类似的命令来扩展 globs?(我想使用 xargs 以便该命令可以并行运行)
在 bash 中,如果你 cd 到 // 你的密码将是 //,但如果你 cd 到 / 或 ///+ 你的密码将是 /。这是有原因的还是只是一个奇怪的错误?
我已经在 osx 和 ubuntu 中尝试过这个。