📄 childproof
字号:
#!/bin/sh# Ensure that cp/mv don't clobber a just-copied file.# With fileutils-4.1 and earlier, this test would fail.if test "$VERBOSE" = yes; then set -x cp --version mv --versionfi. $srcdir/../envvar-check. $srcdir/../lang-defaultPRIV_CHECK_ARG=require-non-root . $srcdir/../priv-checkpwd=`pwd`tmp=childproof.$$trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0trap '(exit $?); exit' 1 2 13 15framework_failure=0mkdir $tmp || framework_failure=1cd $tmp || framework_failure=1mkdir a b c || framework_failure=1echo a > a/f || framework_failure=1echo b > b/f || framework_failure=1if test $framework_failure = 1; then echo 'failure in testing framework' 1>&2 (exit 1); exitfifail=0cp a/f b/f c 2> /dev/null && fail=1test -f a/f || fail=1test -f b/f || fail=1test -f c/f || fail=1test "`cat c/f`" = a || fail=1rm -f c/f# With --backup=numbered, it should succeedcp --backup=numbered a/f b/f c || fail=1test -f a/f || fail=1test -f b/f || fail=1test -f c/f || fail=1test -f c/f.~1~ || fail=1rm -f c/f*mv a/f b/f c 2> /dev/null && fail=1test -f a/f && fail=1test -f b/f || fail=1test -f c/f || fail=1test "`cat c/f`" = a || fail=1# Make sure mv still works when moving hard links.# This is where the same_file test is necessary, and why# we save file names in addition to dev/ino.rm -f c/f* b/ftouch a/fln a/f b/gmv a/f b/g c || fail=1test -f a/f && fail=1test -f b/g && fail=1test -f c/f || fail=1test -f c/g || fail=1touch a/f b/f b/gmv a/f b/f b/g c 2> /dev/null && fail=1test -f a/f && fail=1 # a/f should have been movedtest -f b/f || fail=1 # b/f should remaintest -f b/g && fail=1 # b/g should have been movedtest -f c/f || fail=1test -f c/g || fail=1(exit $fail); exit
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -