在tmp目录创建临时文件

5年以前  |  阅读数:471 次  |  编程语言:Shell 
#!/bin/bash

# creating a temp file in /tmp

tempfile=`mktemp -t tmp.XXXXXX`

echo "This is a test file" > $tempfile
echo "This is the second line of the test" >> $tempfile

echo ”The temp is locate at : $tempfile“
cat $tempfile
rm -f $tempfile

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8