Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
实际上,我想使用 shell 脚本将文件从“文件夹-a”复制到“文件夹-b”,例如,“文件夹-a”包含四个文件,即;file1 file2 file3 file4 但是,当它复制到目标时,脚本要求用户重命名每个文件,然后脚本将其复制到具有新名称的“文件夹-b”。
编写这个脚本:
#!/bin/sh for f in $1/*; do read -p "New name for $f:" g scp $f $2/$g done
然后在命令行上:
./my-script.sh folder-a folder-b