2018-08-13

2018-08-13  本文已影响0人  李不韦

shell写正则表达式=~后面必须不加双引号


image.png

!/bin/bash

function getdir(){
for element in ls $1
do
dir_or_file=1element
if [ -d dir_or_file ] then getdirdir_or_file
else
if [[ "dir_or_file ]]
then
echo dir_or_file fi if [[ dir_or_file" =~ .sh]] then echodir_or_file
fi
fi
done
}
root_dir="/home/work/mingyouchen/libowei"
getdir $root_dir

上一篇 下一篇

猜你喜欢

热点阅读