196 reputation
4
bio website
location PL
age
visits member for 1 year, 3 months
seen Oct 14 '13 at 1:24

Feb
24
accepted An -e option to cd builtin
Feb
24
comment An -e option to cd builtin
GNU bash, version 4.2.37(1)-release (i686-pc-linux-gnu)
Feb
24
asked An -e option to cd builtin
Feb
18
comment Practical use for moving file descriptors
But since this moving fd "command" is inherited to the scope of the curly braces and beacuse redirections are processed from left-to-right order, an attempt to 2>&1 should result in an error... Moreover, this stdout seems to be closed even after that command line, I mean using an utility that writes to stdout yields an error "write error: Bad file descriptor" under bash.
Feb
18
comment Practical use for moving file descriptors
{ var=$(cmd 2>&1 >&3) ; } 3>&1- Isn't it a typo in closing 1?
Feb
18
accepted Why is it possible to refer to a closed stderr under bash?
Feb
18
accepted Stderr of piped shell scripts isn't always displayed
Feb
18
comment Why is it possible to refer to a closed stderr under bash?
How do you explain these: echo test 2>&- 1>&2 #ok and echo test 1>&- 2>&1 #error
Feb
18
asked Why is it possible to refer to a closed stderr under bash?
Feb
18
asked Stderr of piped shell scripts isn't always displayed
Feb
17
accepted Significance of arrows symbols in duplicating/closing file descriptors under bash
Feb
17
comment Practical use for moving file descriptors
Thanks, now I know what moving a fd is. I have 4 basic questions regarding the 2nd snippet (and fds in general): 1) In cmd1, you make 2 (stderr) to be a copy of 3, what if the command would internally use this 3 fd? 2) Why do 3>&1 and 4>&1 work? Duplicating 3 and 4 takes effect only in those two cmds, is the current shell also affected? 3) Why do you close 4 in cmd1 and 3 in cmd2? Those commands don't use mentioned fds, do they? 4) In the last snippet, what happens if a fd is duplicated to a non-existent one (in cmd1 and cmd2), I mean to 3 and 4, respectively?
Feb
17
awarded  Scholar
Feb
17
accepted Practical use for moving file descriptors
Feb
17
awarded  Editor
Feb
17
comment Significance of arrows symbols in duplicating/closing file descriptors under bash
Right, my bad. However, the link doesn't answer my question...
Feb
17
revised Significance of arrows symbols in duplicating/closing file descriptors under bash
typo
Feb
16
comment Practical use for moving file descriptors
Still don't get it. If 5>&1 sends 5 to where 1 is going, then what exactly does 1>&5- do, besides closing 5?
Feb
16
comment Practical use for moving file descriptors
But why not to duplicate file descriptor 1 in the following way: 5>&1? I don't understand what's the use of moving FD since the kernel is about to close it right after...
Feb
16
awarded  Student