bug-bash
[Top][All Lists]
Advanced

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

Re: echo x > a > b > c > d


From: Eduardo Bustamante
Subject: Re: echo x > a > b > c > d
Date: Sun, 16 Apr 2017 19:49:40 -0500

On Sun, Apr 16, 2017 at 7:40 PM, 積丹尼 Dan Jacobson <address@hidden> wrote:
> OK sorry. I guess they make a lot of sense.

These constructs are valid grammatically, and have a well defined
semantic meaning. See:

address@hidden:~$ strace -e open bash -c ': <a <b <c <d' 2>&1|tail -n5
open("a", O_RDONLY)                     = 3
open("b", O_RDONLY)                     = 3
open("c", O_RDONLY)                     = 3
open("d", O_RDONLY)                     = 3
+++ exited with 0 +++

address@hidden:~$ strace -e open bash -c ': >a >b >c >d' 2>&1|tail -n5
open("a", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
open("b", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
open("c", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
open("d", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
+++ exited with 0 +++

Yes, it might be an awkward thing to write in a script, but it's still
valid. If you want recommendations on bad shell scripting practices,
perhaps you might want to try shellcheck instead?



reply via email to

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