📄 cp-mv-backup
字号:
#!/bin/sh# Test basic --backup functionality for both cp and mv.if test "$VERBOSE" = yes; then set -x cp --versionfi# Ensure that ls sorts the same way for everyone.. $srcdir/../lang-default. $srcdir/../envvar-checkumask 022# Be careful to close $actual before removing the containing directory.# Use `1>&2' rather than `1<&-' since the latter appears not to work# with /bin/sh from powerpc-ibm-aix4.2.0.0.pwd=`pwd`t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$trap 'status=$?; cd $pwd; exec 1>&2; rm -rf $t0 && exit $status' 0trap '(exit $?); exit' 1 2 13 15framework_failure=0mkdir -p $tmp || framework_failure=1cd $tmp || framework_failure=1if test $framework_failure = 1; then echo "$0: failure in testing framework" 1>&2 (exit 1); exitfiactual=actualexpected=expectedexec 1> $actualfail=0for prog in cp mv; do for initial_files in 'x' 'x y' 'x y y~' 'x y y.~1~' 'x y y~ y.~1~'; do for opt in none off numbered t existing nil simple never; do touch $initial_files $prog --backup=$opt x y || fail=1 echo $initial_files $opt: `ls [xy]*`; rm -f x y y~ y.~?~ done donedonecat <<\EOF > $expected-tmpx none: x yx off: x yx numbered: x yx t: x yx existing: x yx nil: x yx simple: x yx never: x yx y none: x yx y off: x yx y numbered: x y y.~1~x y t: x y y.~1~x y existing: x y y~x y nil: x y y~x y simple: x y y~x y never: x y y~x y y~ none: x y y~x y y~ off: x y y~x y y~ numbered: x y y.~1~ y~x y y~ t: x y y.~1~ y~x y y~ existing: x y y~x y y~ nil: x y y~x y y~ simple: x y y~x y y~ never: x y y~x y y.~1~ none: x y y.~1~x y y.~1~ off: x y y.~1~x y y.~1~ numbered: x y y.~1~ y.~2~x y y.~1~ t: x y y.~1~ y.~2~x y y.~1~ existing: x y y.~1~ y.~2~x y y.~1~ nil: x y y.~1~ y.~2~x y y.~1~ simple: x y y.~1~ y~x y y.~1~ never: x y y.~1~ y~x y y~ y.~1~ none: x y y.~1~ y~x y y~ y.~1~ off: x y y.~1~ y~x y y~ y.~1~ numbered: x y y.~1~ y.~2~ y~x y y~ y.~1~ t: x y y.~1~ y.~2~ y~x y y~ y.~1~ existing: x y y.~1~ y.~2~ y~x y y~ y.~1~ nil: x y y.~1~ y.~2~ y~x y y~ y.~1~ simple: x y y.~1~ y~x y y~ y.~1~ never: x y y.~1~ y~EOFsed 's/: x/:/' $expected-tmp |cat $expected-tmp - > $expectedcmp $expected $actual || fail=1# Uncomment this if you see a failure and want to try to diagnose it.test $fail = 1 && diff -c $expected $actual 1>&2(exit $fail); exit
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -