linux-tutorial/codes/shell/输入和输出/在tmp目录创建临时文件.sh

13 lines
259 B
Bash
Raw Normal View History

2019-10-29 18:22:19 +08:00
#!/usr/bin/env bash
2019-05-10 11:17:57 +08:00
# 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
2019-10-10 08:56:31 +08:00
echo ” The temp is locate at : $tempfile
2019-05-10 11:17:57 +08:00
cat $tempfile
rm -f $tempfile