4 ms·
$ grep somestring file1 > /tmp/a $ grep somestring file2 > /tmp/b $ diff /tmp/a /tmp/b You shouldn't do that, but not because it's not neat enough. /tm
by jwilk 9y ago
$ grep somestring file1 > /tmp/a
$ grep somestring file2 > /tmp/b
$ diff /tmp/a /tmp/b
You shouldn't do that, but not because it's not neat enough.
/tmp is world-writable, so you might be writing to somebody else's file, or over a symlink that was set up by someone else.
Use mktemp¹ for creating temporary files.
¹ http://man7.org/linux/man-pages/man1/mktemp.1.html http://man7.org/linux/man-pages/man1/mktemp.1.html