How to create a temporary file with portable shell in a secure way?

前端 未结 3 656
说谎
说谎 2021-02-14 11:32

I want to create a temporary file in POSIX shell (/bin/sh).

I found out that mktemp(1) doens\'t exist on my AIX box, and according to How port

3条回答
  •  长发绾君心
    2021-02-14 12:23

    Got here from google for portable mktemp. My needs are less secure than OP's, so I ended up just using the script's PID:

    tempx=/tmp/mytemp.$$
    

提交回复
热议问题