我想循环以'.'开头的文件.在目录x中(x可能是任何路径):
$ for file in x/.*
> do
> echo -n $file" "
> done
x/. x/.. x/..a x/.b
Run Code Online (Sandbox Code Playgroud)
什么是摆脱x /.和x/..的最佳方法?
用bash,你可以使用 GLOBIGNORE
$ ls -1tra
..
.test1
.test
test
.
$ for i in .*; do echo $i;done
.
..
.test
.test1
$ GLOBIGNORE=".:.."
$ for i in .*; do echo $i;done
.test
.test1
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
285 次 |
| 最近记录: |