编写一个 shell 脚本,它把第二个位置参数及其以后的各个参数指定的文件拷贝到第一个位置参数指定的目录中
#!/bin/bash
dir=$1
shift
while [ $1 ]
do
file = $1
cp $file $dir
shift
done
ls $dir
运行结果:
a ha1.c ha.c ll oo qq sc ww 模板 图片 下载 桌面
dd ha2.c hh nn pp s sh 公共 视频 文档 音乐
我的文件是a。