On Tue, 2022-08-16 at 07:24 -0400, Greg Wooledge wrote: > The following two commands are equivalent: > > echo 1 > sudo /proc/sys/vm/drop_caches > > echo 1 /proc/sys/vm/drop_caches > sudo > > The file "sudo" will have "1 /proc/sys/vm/drop_caches" in it, because > echo received two arguments. Redirections may appear anywhere in a > "simple" command. It's conventional to write them at the end of the > command, but the shell permits them to be anywhere. > > This is a standard feature of all POSIX shells, by the way. Not a > bash extension.
I should have remembered this as I learnt it a couple of years ago when implementing a POSIX shell (subset thereof). -- Tixy