本文共 860 字,大约阅读时间需要 2 分钟。
目录遍历脚本
[root@NewCDH-0--144 opt]# cat dir.sh#!/usr/bin/shDIR=$(cd "$(dirname "$0")"; pwd)echo "当前目录:$DIR"ROOT=$DIRfor file in $ROOT/*doif [ -d "$file" ]then echo "$file" cd $file #pwd & git statusfidone
[root@NewCDH-0--144 opt]# ll
total 20-rw-r--r-- 1 root root 337 Feb 25 13:20 back_log.shdrwxr-xr-x. 4 cloudera-scm cloudera-scm 39 Mar 15 2018 cloudera-rw-r--r-- 1 root root 189 Mar 7 13:02 dir.shdrwxr-xr-x 4 root root 109 Aug 29 2018 falcon-agentdrwxr-xr-x 3 root root 85 Dec 3 17:17 flinkdrwxr-xr-x 2 root root 4096 Mar 4 18:29 majihuidrwxr-xr-x 4 root root 4096 Oct 16 10:14 mysql-rw-r--r-- 1 root root 144 Jan 31 18:14 test.txtdrwxr-xr-x 2 root root 49 Nov 7 17:12 zabbix[root@NewCDH-0--144 opt]# sh dir.sh 当前目录:/opt/opt/cloudera/opt/falcon-agent/opt/flink/opt/majihui/opt/mysql/opt/zabbix转载于:https://blog.51cto.com/12445535/2359481