I typed it by mistake but bash didn't print any errors (but created an empty file) so I thought maybe it actually means something ? (e.g. date |> tmp.txt)
That seems to be just a pipeline where the second part is an empty command, only containing the redirection. Writing it as
date | >file might make it easier to interpret. The empty command doesn't do anything but process the redirection, creating the file.
date >| file on the other hand would act as an override for the
noclobber shell option, which prevents the regular
> from overwriting existing files.
$ touch foo; set -o noclobber $ date > foo bash: foo: cannot overwrite existing file $ date >| foo # works
Yes, it will not throw error because for bash
> file means redirect to a file named
file. As in your case there is nothing to redirect to file, bash will just create a file name
file with nothing in it.
[email@example.com my-tests]$ date | > my_file [firstname.lastname@example.org my-tests]$ cat my_file [email@example.com my-tests]$