gpt4 book ai didi

linux - 这可以打印在同一行吗?

转载 作者:太空狗 更新时间:2023-10-29 11:39:43 25 4
gpt4 key购买 nike

此命令将统计子目录中的文件数。

find . -maxdepth 1 -type d |while read dir;do echo "$dir";find "$dir" -type f|wc -l;done

看起来像

./lib64
327
./bin
118

有没有可能让它看起来像

327 ./lib64
118 ./bin

代替?

最佳答案

有很多方法可以做到这一点...这里有一些不会对您的代码造成太大改变的方法。 (为了便于阅读,我将其分为多行。)

find . -maxdepth 1 -type d | while read dir; do
echo `find "$dir" -type f | wc -l` "$dir"
done

关于linux - 这可以打印在同一行吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6012296/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com