On 2020-01-03 13:44, Warner Losh wrote:
On Fri, Jan 3, 2020, 1:39 PM markus schnalke
<meillo(a)marmaro.de> wrote:
Hoi.
[2020-01-03 13:45] markus schnalke <meillo(a)marmaro.de>
I'd be interested in any stories and information around this
topic.
Especially I'd like to know since when and why ``>file'' is a
full command? Was it clever design or by accident?
It's used to open files in shell scripts. Iirc, exec >foo 5>& and the
like...
I've also used it to truncate files:
$ dd if=/dev/zero of=file count=10
10+0 records in
10+0 records out
5120 bytes (5.1 kB, 5.0 KiB) copied, 0.000686599 s, 7.5 MB/s
$ ls -l file
-rw-rw-r-- 1 mparson mparson 5120 Jan 3 16:45 file
$ >file
$ ls -l file
-rw-rw-r-- 1 mparson mparson 0 Jan 3 16:46 file
A more likely use case is to truncate a log file then HUP syslogd.
--
Michael Parson
Pflugerville, TX
KF5LGQ