ex48.sh
来自「Shall高级编程」· Shell 代码 · 共 38 行
SH
38 行
#!/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="$1"destination="$2"###################################################################find "$source" -depth | cpio -admvp "$destination"# ^^^^^ ^^^^^# Read the 'find' and 'cpio' info pages to decipher these options.# The above works only relative to $PWD (current directory) . . .#+ full pathnames are specified.#################################################################### Exercise:# --------# Add code to check the exit status ($?) of the 'find | cpio' pipe#+ and output appropriate error messages if anything went wrong.exit $?
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?