Debian Codegraph @

examples/demo_tmpfile

raw
1 #!/usr/bin/env runawk
2
3 #use "tmpfile.awk"
4 #use "exitnow.awk"
5
6 # This demo generates temporary file names and outputs them to stdout
7
8 BEGIN {
9 tmpfile1 = tmpfile()
10 tmpfile2 = tmpfile()
11 tmpsubdir = tmpfile()
12
13 print "file 1" > tmpfile1
14
15 print "file 2" > tmpfile2
16
17 system("mkdir " tmpsubdir)
18
19 tmpfile3 = tmpsubdir "/file3"
20 print "file 3" > tmpfile3
21
22 close(tmpfile1)
23 close(tmpfile2)
24 close(tmpfile3)
25
26 system("cat " tmpfile1 " " tmpfile2 " " tmpfile3)
27
28 exitnow(0)
29 }