解决了使用ln -s target linkName创造软链接无法正确取到真实脚本的问题. #!/bin/bash SOURCE="$0" while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )&q
[脚本6]拷贝目录 编写shell脚本,把/root/目录下的所有目录(只需要一级)拷贝到/tmp/目录下: 一.脚本 #!/bin/bash cd /root list=(`ls`) for i in ${list[@]} do if [-d $i] then cp -r $i /tmp/ fi done 二.小结 1.Linux目录 [1]linux列出一个目录及其子目录下面的某种类型的文件 https://www.cnblogs.com/AloneSword/p/4488969.html