fail-diag

来自「Linux下文件工具。」· 代码 · 共 51 行

TXT
51
字号
#!/bin/sh# make sure touch gives reasonable diagnosticsif test "$VERBOSE" = yes; then  set -x  touch --versionfi. $srcdir/../envvar-check. $srcdir/../lang-defaultPRIV_CHECK_ARG=require-non-root . $srcdir/../priv-checkpwd=`pwd`tmp=fail-diag.$$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 'failure in testing framework' 1>&2  (exit 1); exitfifail=0# Before fileutils-4.1, we'd get the following misleading# diagnostic instead of `Permission denied'.# touch: creating `/': Is a directorytouch / > out 2>&1 && fail=1touch /no/such-dir >> out 2>&1 && fail=1# On SunOS4, EPERM is `Not owner'.# On some *BSD systems it's `Operation not permitted'.for msg in 'Not owner' 'Operation not permitted' 'Permission denied'; do  cat > exp <<EOF  touch: setting times of \`/': $msg  touch: creating \`/no/such-dir': No such file or directoryEOF  cmp out exp > /dev/null 2>&1 && breakdonetest $fail = 1 && diff out exp 2> /dev/null(exit $fail); exit

⌨️ 快捷键说明

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