About file appending in ECS Exec

0

I am trying to append No.1 to a file in a container with ECS Exec command, but it is not appended.

aws ecs excute-command --cluster xxxx --task xxxxxxxxxxxxxx --container app --interactive --command "sed -i '$aADD' /tmp/xxx"

已提問 1 年前檢視次數 483 次
3 個答案
0

First, the $a syntax you're using in your sed command is used to append text after a specific line number, rather than at the end of the file. To append text at the end of the file, you should use the $ symbol alone.

Second, it's possible that the sed command is not working because of a permission issue or a problem with the file location or content.

maybe you can use

aws ecs execute-command --cluster <cluster-name> --task <task-id> --container <container-name> --interactive --command "echo 'ADD No.1' >> /tmp/<filename>"
profile picture
專家
已回答 1 年前
0

I tried the following command, but cannot append into file.

aws ecs excute-command --cluster xxxx --task xxxxxxxxxxxxxx --container app --interactive --command "echo 'No.1 add' >> /tmp/xxx"

已回答 1 年前
0

I append character into file by using ecs exec.

aws ecs excute-command --cluster xxxx --task xxxxxxxxxxxxxx --container app --interactive --command "/bin/sh -c 'echo dummy char >> /tmp/xxx'"

已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南