📄 ex48.sh
字号:
#!/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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -