Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Thank you ! Can you please explain what the ">&3 2>&4 ..." mean? Or, if not, can you briefly point me to where I can understand these? Commented May 11, 2016 at 7:59
  • I tried tps=$({ time run_eclipse_on $1 $2/$i >&3 2>&4; } 2>&1) 3>&1 4>&2; echo "$i::$stat::::$tps"; , but it fails with "bad file descriptor". But if I only write tps=$({ time run_eclipse_on $1 $2/$i; } ) ;, it runs, although it does not print the stat. I understand that >$n are redirections, but what is the scheme these redirections are following ? Is it a standard way to redirect ? Is it specific to this code ? Commented May 11, 2016 at 8:25
  • [UPDATE] I found a way of doing what I wanted but it's ugly: tps=$({ time run_eclipse_on $1 $2/$i >mytemp 4>&2 2>&4; } 2>&1) 4>&2; stat=$(<mytemp); echo "$i::$stat::$tps"; And rm mytemp afterwards...(It works also with no "2" and "4" redirection, but I kept them because, for some, the time was printed on a new line and using awk to remove any undesired new lines didn't work) Commented May 11, 2016 at 9:19
  • 1
    @ZakC I'd messed up the file descriptors, but anyway what I wrote fundamentally didn't work because the stat variable was set in a subshell and used in the parent. I've edited my answer to provide a different solution. Commented May 11, 2016 at 11:03