ex48.sh

来自「一本完整的描述Unix Shell 编程的工具书的所有范例」· Shell 代码 · 共 34 行

SH
34
字号
#!/bin/bash# Copying a directory tree using 'cpio.'# Advantages of using 'cpio':#   Speed of copying. It's faster than 'tar' with pipes.#   Well suited for copying special files (named pipes, etc.)#+  that 'cp' may choke on.ARGS=2E_BADARGS=65if [ $# -ne "$ARGS" ]then  echo "Usage: `basename $0` source destination"  exit $E_BADARGSfi  source=$1destination=$2find "$source" -depth | cpio -admvp "$destination"#               ^^^^^         ^^^^^# Read the 'find' and 'cpio' man page to decipher these options.# Exercise:# --------#  Add code to check the exit status ($?) of the 'find | cpio' pipe#+ and output appropriate error messages if anything went wrong.exit 0

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?