diag

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

TXT
56
字号
#!/bin/sh# make sure we get proper diagnostics: e.g., with --target-dir=d but no argsif test "$VERBOSE" = yes; then  set -x  mv --versionfi# Make sure we get English translations.. $srcdir/../lang-defaultpwd=`pwd`tmp=diag-$$trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0trap 'exit $?' 1 2 13 15framework_failure=0mkdir $tmp || framework_failure=1cd $tmp || framework_failure=1touch f1 || framework_failure=1touch f2 || framework_failure=1touch d || framework_failure=1if test $framework_failure = 1; then  echo 'failure in testing framework'  exit 1fi# These mv commands should all exit nonzero.# Too few args.  This first one did fail, but with an incorrect diagnostic# until fileutils-4.0u.mv --target=d >> out 2>&1 && fail=1mv no-file >> out 2>&1 && fail=1# Target is not a directory.mv f1 f2 f1 >> out 2>&1 && fail=1mv --target=f2 f1 >> out 2>&1 && fail=1cat > exp <<\EOFmv: missing file argumentTry `mv --help' for more information.mv: missing file argumentTry `mv --help' for more information.mv: when moving multiple files, last argument must be a directoryTry `mv --help' for more information.mv: specified target, `f2' is not a directoryTry `mv --help' for more information.EOFcmp out exp || fail=1(exit $fail)exit $fail

⌨️ 快捷键说明

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