⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dup-source

📁 实战Linux编程的原代码,希望对学驱动的人能有所帮助
💻
字号:
#!/bin/sh# Ensure that cp merely warns when a non-directory source file is# listed on the command line more than once.  fileutils-4.1.1# made this fail:  cp a a d/# Ensure that mv fails with a similar command.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=dup-src.$$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=1if test $framework_failure = 1; then  echo "$0: failure in testing framework" 1>&2  (exit 1); exitfifail=0for i in cp; do  # cp may not fail in this case.  rm -fr a d; touch a; mkdir d  $i a a d/ 2> out || fail=1  rm -fr a d; touch a; mkdir d  $i ./a a d/ 2>> out || fail=1  # cp succeeds with --backup=numbered.  rm -fr a d; touch a; mkdir d  $i --backup=numbered a a d/ 2>> out || fail=1  # But not with plain `--backup'  rm -fr a d; touch a; mkdir d  $i --backup a a d/ 2>> out && fail=1  cat <<EOF > exp$i: warning: source file \`a' specified more than once$i: warning: source file \`a' specified more than once$i: will not overwrite just-created \`d/a' with \`a'EOF  cmp out exp || fail=1  test $fail = 1 && diff out exp 2> /dev/nulldonefor i in mv; do  # But mv *does* fail in this case (it has to).  rm -fr a d; touch a; mkdir d  $i a a d/ 2> out && fail=1  rm -fr a d; touch a; mkdir d  $i ./a a d/ 2>> out && fail=1  cat <<EOF > exp$i: cannot stat \`a': No such file or directory$i: cannot stat \`a': No such file or directoryEOF  cmp out exp || fail=1  test $fail = 1 && diff out exp 2> /dev/nulldone(exit $fail); exit

⌨️ 快捷键说明

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