如何保存shell中正则匹配的结果?
for file in ./a*/data; do scp -qr $file user@host.name:~/${file/\/data/_data}; done;if rootdir is on a remote host, try
for file in `ssh user@host.name "ls /rootdir/a*/data"`; do scp -qr user@host.name:${file/:/} ${file/\/data/_data}; done;
原发布于 https://www.zhihu.com/question/19888200/answer/13259778