linux系统用shell写程序找出根目录下的文件夹及路径
答案:4 悬赏:60
解决时间 2021-11-16 02:46
- 提问者网友:时间却是纷扰
- 2021-11-15 05:33
请将代码写下来,谢谢!本人初学者!!
最佳答案
- 二级知识专家网友:為→妳鎖鈊
- 2021-11-15 05:54
#!/bin/bash
##only show / dir maxdepth one
result=`ls -p / |grep /|tr -d /`
echo $result
##no "-maxdepth" ,show all ,number 1,the same above, 2show / and one sub dir.etc...
new=`find / -type d -maxdepth 1`
echo $new
##only show / dir maxdepth one
result=`ls -p / |grep /|tr -d /`
echo $result
##no "-maxdepth" ,show all ,number 1,the same above, 2show / and one sub dir.etc...
new=`find / -type d -maxdepth 1`
echo $new
全部回答
- 1楼网友:24K纯糖
- 2021-11-15 10:08
列出目录 ls -d */
列出文件 du -a /
- 2楼网友:哥在撩妹请勿打扰
- 2021-11-15 08:46
#!/bin/bash
for line in "$@" ; do
if [ "$line" == "/" ];then
echo " can't rm / "
exit 0;
fi
done
rm $*
- 3楼网友:两不相欠
- 2021-11-15 07:24
很简单的两条命令,一楼正解,而且可以查到包括隐藏文件在内的所有文件
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯