[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Why can redirection be combined in an assignment statement?
From: |
Peng Yu |
Subject: |
Why can redirection be combined in an assignment statement? |
Date: |
Mon, 10 May 2021 10:40:47 -0500 |
I can not see why redirection is allowed in an assignment statement.
For example, redirection in the following command does not do anything
useful.
x=10 < /tmp/1.txt
Is there a useful situation in which redirection does do something
useful in an assignment statement? If not, why not prompt an error for
this case?
I can think of this, which basically truncate or create a new file
/tmp/1.txt, and perform the assignment. But I don't see a point to
combine both in a single line. Therefore, I would not consider this is
as a useful situation.
>/tmp/1.txt x=10
--
Regards,
Peng
- Why can redirection be combined in an assignment statement?,
Peng Yu <=
Re: Why can redirection be combined in an assignment statement?, Koichi Murase, 2021/05/10
Re: Why can redirection be combined in an assignment statement?, Eli Schwartz, 2021/05/10
Re: Why can redirection be combined in an assignment statement?, Chet Ramey, 2021/05/10