我想将 file1 移动到当前目录的许多子目录中的 directory1。file1 和 directory1 都在每个子目录中。我在当前目录中编写了以下脚本,但它报告“./mv.sh: line 4: cd: directory1: No such file or directory”。实际上,directory1 在每个子目录中。
1 #!/bin/bash
2
3 for i in *; do
4 builtin cd $i
5 mv file1 directory1
6 builtin cd ..
7 done
错误
./mv.sh: line 4: cd: directory1: No such file or directory
mv: cannot stat `file1': No such file or directory