News for hackers. Stuff that matters.
Re:What does " 2>&1 " mean? by nothrabannosir on Thursday February 26, 2026 @11:05PM (#47176368)
The aws cli has a set of porcelain for s3 access (aws s3) and plumbing commands for lower level access to advanced controls (aws s3api). The plumbing command aws s3api get-object doesn't support stdout natively, so if you need it and want to use it in a pipeline (e.g. pv), you would naively do something like

  $ aws s3api get-object --bucket foo --key bar /dev/stdout | pv ...
Unfortunately, aws s3api already prints the API response to stdout, and error messages to stderr, so if you do the above you'll clobber your pipeline with noise, and using /dev/stderr has the same effect on error.

You can, though, do the following:

  $ aws s3api get-object --bucket foo --key bar /dev/fd/3 3>&1 >/dev/stderr | pv ...
This will pipe only the object contents to stdout, and the API response to /dev/null.
Re:What does " 2>&1 " mean? by stabbles on Friday February 27, 2026 @01:52AM (#47177393)
Would be nice if `curl` had something to dump headers to a third file descriptor while outputting the response on stdout.
Re:What does " 2>&1 " mean? by homebrewer on Friday February 27, 2026 @03:38AM (#47178131)
This should work?

  curl --dump-header /dev/fd/xxx https://google.com
or

  mkfifo headers.out
  curl --dump-header headers.out https://google.com
unless I'm misunderstanding you.
Re:What does " 2>&1 " mean? by stabbles on Friday February 27, 2026 @03:50AM (#47178228)
Ah yeah, `/dev/fd/xxx` works :) somehow thought that was Linux only.
Re:What does " 2>&1 " mean? by xantronix on Friday February 27, 2026 @11:21AM (#47182333)
(Principal Skinner voice) Ah, it's a Bash expression!