📄 into-self
字号:
#! /bin/sh# Demonstrate how mv fails when it tries to move a directory into itself.if test "$VERBOSE" = yes; then set -x mv --versionfidir=toself-dirfile=toself-filetest_failure=0rm -rf $dir $file || test_failure=1mkdir -p $dir/a/b || test_failure=1touch $file || test_failure=1if test $test_failure = 1; then echo 'failure in testing framework' exit 1fifail=0# Make sure we get English translations.. $srcdir/../lang-default# This mv command should fail.mv $dir $file $dir > out 2>&1 && fail=1sed \ -e "s,mv:,XXX:," \ -e "s,$dir,SRC," \ -e "s,$dir/$dir,DEST," \ out > out2cat > exp <<\EOFXXX: cannot move `SRC' to a subdirectory of itself, `DEST'EOFcmp out2 exp || fail=1# Make sure the file is gone.test -f $file && fail=1# Make sure the directory is *not* moved.test -d $dir || fail=1test -d $dir/$dir && fail=1# Make sure the file has been moved to the right place.test -f $dir/$file || fail=1rm -rf $dir $file out out2 expexit $fail
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -