#!/bin/bash function readDir(){ #echo $1 #echo $2 targetDir=`ls $1` #
It's on the keyboard '~' The symbol below , It's not a single quotation mark for fileName in $targetDir do if [ -d $1"/"$fileName ] #
There should be spaces at both ends , Otherwise, the report is wrong then #echo $1"/"$fileName readDir $1"/"$fileName $2 else #echo
$fileName #echo ${fileName:0-3} if [[ ${fileName:0-3} == '.py' ]]; # Find extension for
.py File for then echo $1"/"$fileName >> $2/findPy elif [[ ${fileName:0-5} == '.html'
]]; # Find extension for .html File for then echo $1"/"$fileName >> $2/findHtml elif [[
${fileName:0-3} == '.js' ]]; # Find extension for .js File for then echo $1"/"$fileName >>
$2/findJs elif [[ ${fileName:0-2} == '.h' ]]; # Find extension for .h File for then echo
$1"/"$fileName >> $2/findC fi fi done } readDir $1 $2 # Each represents two parameters , It is passed in when calling later
' Traverse target folder path ' and ' Traversal result save path '
Add execution permissions to scripts :
chmod 755 findClass.sh (7:x: implement =1 + r: read =4 +w: write =2;5:x + r) perhaps chmod +x
findClass.sh
Execute script :
./findClass.sh ' Traverse target folder path ' ' Traversal result save path '
Technology