我的剧本
#!/bin/bash
for dir in $(/home/milenko/Documents/mt/MT8 -type d -maxdepth 1); do
cp -i kop.sh "$dir"/;
done
但是
p.sh: line 3: /home/milenko/Documents/mt/MT8: Is a directory
修改
现在插入了
find /home/milenko/Documents/mt/MT8 -type d -maxdepth 1
使用find,工作得很好。我收到了这个警告
find: warning: you have specified the -maxdepth option after a non-option argument -type, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it). Please specify options before other arguments.
为什么?
答案 0 :(得分:1)
错误消息非常清楚,您提供的路径是目录的路径。通过你传递的参数,我假设你应该像
中那样使用find
find /home/milenko/Documents/mt/MT8 -type d -maxdepth 1