[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Possible bug with redirect.

From: Rikke Rendtorff
Subject: Possible bug with redirect.
Date: Mon, 1 Nov 2021 16:23:32 +0100

I'm very new to linux, so I apologize if I'm reporting a non-bug.

I wanted to do this: date > `date +"%Y-%m-%d"`.txt to put the date into a
file called 2021-10-16.txt

But I accidentally forgot the backticks, so it became date > date
+"%Y-%m-%d".txt. And it created a file called "date" and it put the string
"2021-10-16.txt" into it.

I can understand why the file is called "date", but I got somewhat confused
about how the content became the '+"%Y-%m-%d".txt' part.

It seems that the date +"%Y-%m-%d".txt is the command part with the one
So we have: date redirect-part +"%Y-%m-%d".txt
If I wanted the result that I got, I'd expect the command to be: date
+"%Y-%m-%d".txt redirect-part.

I went to the https://linuxmint.com community website and joined their IRC
chat to see if they had an explanation and they told me it may be a bug,
since they couldn't reproduce it for other commands.

Rikke Rendtorff

P.S. They also told me I may be one of those users that gets myself into
trouble by using commands in ways that no sane person would ever think of.
So, at least there's that :)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]