into-self-2

来自「实战Linux编程的原代码,希望对学驱动的人能有所帮助」· 代码 · 共 60 行

TXT
60
字号
#!/bin/sh# Force mv to use the copying code.# Consider the case where SRC and DEST are on different# partitions and DEST is a symlink to SRC.if test "$VERBOSE" = yes; then  set -x  mv --versionfi. $srcdir/setup. $srcdir/../envvar-checkif test -z "$other_partition_tmpdir"; then  exit 77fifile="$other_partition_tmpdir/file"symlink=symlinkfail=0trap 'rm -fr out out2 exp $file $symlink $other_partition_tmpdir; exit $fail' \  0 1 2 3 15framework_failure=0rm -f $file $symlink || framework_failure=1echo whatever > $file || framework_failure=1ln -s $file $symlink || framework_failure=1if test $framework_failure = 1; then  echo 'failure in testing framework'  exit 1fi# Make sure we get English translations.. $srcdir/../lang-default# This mv command should exit nonzero.mv $symlink $file > out 2>&1 && fail=1# This should succeed.mv $file $symlink || fail=1sed \   -e "s,mv:,XXX:," \   -e "s,$file,YYY," \   -e "s,$symlink,ZZZ," \  out > out2cat > exp <<\EOFXXX: `ZZZ' and `YYY' are the same fileEOF#'cmp out2 exp || fail=1test $fail = 1 && diff out2 exp 2> /dev/nullexit $fail

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?