LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 572|回复: 2

求教:怎么写:复制abc目录中除文件xyz外所有内容到目录efg?

[复制链接]
发表于 2004-10-8 21:26:37 | 显示全部楼层 |阅读模式
谢谢。
发表于 2004-10-8 21:56:31 | 显示全部楼层
for file in abc/*;do
   if [ $file = "xyz" ];then
       echo "This is $file"
    else
       cp $file efg/
    fi
done

or cp abc/* efg/ and then cd efg and rm xyz
发表于 2004-10-9 01:08:26 | 显示全部楼层

  1. cd /abc
  2. cp $(ls !(xyz)) /path/efg 2>/dev/null
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表