鼎鼎知识库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 3 години
12345678910111213141516171819202122232425262728293031323334353637383940
  1. 拷贝文件
  2. ```
  3. 开始拷贝:cp -i 1.txt 2.txt
  4. 查看:nano 2.txt
  5. ```
  6. 将一个目录中的所有文件复制到另一个目录
  7. ```
  8. cp -r tmp/ tmp1/ (tmp1下会多出tmp文件)
  9. ```
  10. 解压并拷贝的脚本
  11. ```
  12. 文件结构
  13. /root/tmp
  14. archive02.tar.gz
  15. c目录
  16. 创建脚本:nano demo.sh
  17. #!/bin/bash
  18. SOURCE_GZ_FILE="/root/tmp/archive02.tar.gz"
  19. INSTALL_DIR="/root/tmp/c"
  20. echo "解压${SOURCE_GZ_FILE}到安装目录${INSTALL_DIR}"
  21. sudo tar -xzf ${SOURCE_GZ_FILE} -C ${INSTALL_DIR}
  22. TEMP=`ls ${INSTALL_DIR}`
  23. sudo cp -R -t ${INSTALL_DIR} ${INSTALL_DIR}/${TEMP}/*
  24. sudo rm -f ${INSTALL_DIR}/{TEMP}
  25. echo "解压完毕"
  26. ```