| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
tmpfile1=$(mktemp) |
| 4 |
if [ ! -w $tmpfile1 ] ; then |
| 5 |
echo "Failed to create tmp file" >&2 |
| 6 |
exit 1 |
| 7 |
fi |
| 8 |
|
| 9 |
tmpfile2=$(mktemp) |
| 10 |
if [ ! -w $tmpfile2 ] ; then |
| 11 |
echo "Failed to create tmp file" >&2 |
| 12 |
exit 1 |
| 13 |
fi |
| 14 |
|
| 15 |
echo "(" >> $tmpfile2 |
| 16 |
|
| 17 |
tmpdir=$(mktemp -d) |
| 18 |
|
| 19 |
echo "include \"$tmpfile2\" |
| 20 |
include \"$tmpdir/*.nft\" |
| 21 |
x" > $tmpfile1 |
| 22 |
|
| 23 |
echo "=" > $tmpdir/1.nft |
| 24 |
echo ")" > $tmpdir/2.nft |
| 25 |
echo "-" > $tmpdir/3.nft |
| 26 |
|
| 27 |
tmpfile3=$(mktemp) |
| 28 |
if [ ! -w $tmpfile3 ] ; then |
| 29 |
echo "Failed to create tmp file" >&2 |
| 30 |
exit 1 |
| 31 |
fi |
| 32 |
|
| 33 |
echo "In file included from $tmpfile1:1:1-30: |
| 34 |
$tmpfile2:1:1-1: Error: syntax error, unexpected '(' |
| 35 |
( |
| 36 |
^ |
| 37 |
In file included from $tmpfile1:2:1-36: |
| 38 |
$tmpdir/1.nft:1:1-1: Error: syntax error, unexpected '=' |
| 39 |
= |
| 40 |
^ |
| 41 |
In file included from $tmpfile1:2:1-36: |
| 42 |
$tmpdir/2.nft:1:1-1: Error: syntax error, unexpected ')' |
| 43 |
) |
| 44 |
^ |
| 45 |
In file included from $tmpfile1:2:1-36: |
| 46 |
$tmpdir/3.nft:1:1-1: Error: syntax error, unexpected - |
| 47 |
- |
| 48 |
^ |
| 49 |
$tmpfile1:3:2-2: Error: syntax error, unexpected newline, expecting string |
| 50 |
x |
| 51 |
^" > $tmpfile3 |
| 52 |
|
| 53 |
tmpfile4=$(mktemp) |
| 54 |
if [ ! -w $tmpfile4 ] ; then |
| 55 |
echo "Failed to create tmp file" >&2 |
| 56 |
exit 1 |
| 57 |
fi |
| 58 |
|
| 59 |
$NFT -I/tmp/ -f $tmpfile1 2> $tmpfile4 |
| 60 |
$DIFF -u $tmpfile3 $tmpfile4 |
| 61 |
|
| 62 |
rm $tmpfile1 $tmpfile2 $tmpfile3 $tmpfile4 |
| 63 |
rm -r $tmpdir |