你怎么管s3cmd得到一个变种的结果呢?你怎么、变种、结果、s3cmd

2023-09-11 09:40:05 作者:ヤ孩孓气 ζ醋

我需要将图像从S3,处理它的EC2,并保存到S3不同的文件夹。我想在此过程中没有将文件保存到EC2。

I need to get an image from S3, process it on an ec2, and save it to a different folder on S3. I would like to not save the file to ec2 during the process.

是否可以管的结果s3cmd获得S3://桶/图像为VAR?它似乎并没有打印到标准输出?

Is it possible to pipe the result of "s3cmd get s3://bucket/image" to a var? It does not seem to print to standard output?

推荐答案

这将是更好,如果你能在你的情况显示其输出的农产品 s3cmd 。但是,如果你真的想在命令的输出保存到一个变量,你做这种方式:

It would be better if you could show which output produce s3cmd in your case. But if you really want to save the output of the command to a variable you do it this way:

$ a=$(s3cmd get s3://bucket/image)

当您想要保存标准错误也,你做:

When you want to save stderr also, you make:

$ a=$(s3cmd get s3://bucket/image 2>&1)

只有当标准错误

$ a=$(s3cmd get s3://bucket/image 2>&1 > /dev/null)