Here is what I am trying to do:
docker exec -it $1 /bin/bash <<< $CONTAINER_ID
But this doesn't work:
Output: "docker exec" requires at least 2 arguments.
It seems that <<< completely replaces STDIN ignoring $1. Is it possible to replace only one argument with <<<? I know about aliases, but it doesn't suit me. I need to be able to use only standard tools to pass to my colleague a command in which he will change only the last variable, which will replace one or more arguments in the center of the command.
Here is what I am trying to do:
what is it trying to achieve? Please add examples – Jaromanda X May 11 '23 at 07:02to this:
With <<< , I'm trying to replace only the first argument, instead of completely replacing standard input (STDIN).
– Anton Kuznetsov May 11 '23 at 07:18<<<
?" –<<<
redirects stdin and has nothing to do with arguments. Maybe you should read What's the difference between STDIN and arguments passed to command? – Kamil Maciorowski May 11 '23 at 07:44sh -c 'exec docker exec -it "$1" /bin/bash' sh "$CONTAINER_ID"
. It's not an answer to the question in its current form though. – Kamil Maciorowski May 11 '23 at 10:23