setup
来自「实战Linux编程的原代码,希望对学驱动的人能有所帮助」· 代码 · 共 47 行
TXT
47 行
#! /bin/sh# Use df to find a writable directory on a file system different from that# of the current directory. If one is found, create a temporary directory# inside it.test "${CANDIDATE_TMP_DIRS+set}" = set \ || CANDIDATE_TMP_DIRS="$TMPDIR /tmp /var/tmp /usr/tmp $HOME"other_partition_tmpdir=# WARNING: using sed like this to extract the mount point will fail# if the mount point name contains `% '.dot_mount_point=`df --no-sync -P . | sed -n '2s/.*% *//p'`for d in $CANDIDATE_TMP_DIRS; do # Skip nonexistent directories. test -d $d || continue d_mount_point=`df --no-sync -P $d | sed -n '2s/.*% *//p'` # Same partition? Skip it. test x$d_mount_point = x$dot_mount_point && continue # See if we can create a directory in it. if mkdir "$d/df-$$" > /dev/null 2>&1; then other_partition_tmpdir="$d/df-$$" break fidoneif test -z "$other_partition_tmpdir"; then cat <<EOF 1>&2**************************************This test requires a writable directory on a differentdisk partition, and I couldn't find one. I tried these: $CANDIDATE_TMP_DIRSSet your environment variable CANDIDATE_TMP_DIRS to makethis test use a different list.**************************************EOF #'fitest "$VERBOSE" = yes && set -x
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?