工具命令

  1. mktemp 命令
  • mktemp 默认在/tmp/目录下生成tmp.xxxxxxxxx文件
  1. trap 命令
  • trap命令用于指定在接收到信号后将要采取的动作
  • trap command/function signal

示例

    #!/bin/sh
    
    # clear while this script exits.
    trap 'rm -f "$TMPFILE"' EXIT

    TMPFILE=$(mktemp -p `pwd`) || exit 1
    echo "temp file is $TMPFILE"