lxc-attach and execute multiple commands

Skip to first unread message

Saint Michael

May 15, 2021, 6:43:00 PM5/15/21
to LXC users mailing-list
I have been trying hard to execute changes commands this way

lxc-attach -n "$container" -e -- first_commnad;second_command
  lxc-attach -n "$container" -e -- first_commnad\;second_command  
  lxc-attach -n "$container" -e -- "first_commnad;second_command"

but the second command never executes inside the container. lxc-attach does not accept the double-quoted string, just a single command.
How would you do this?

Narcis Garcia

May 16, 2021, 5:44:14 AM5/16/21
to lxc-...@lists.linuxcontainers.org
You may need to use a Bash call:

lxc-attach -n "$container" -e -- sh -c "first_commnad;second_command"

Narcis Garcia

I'm using this dedicated address because personal addresses aren't
masked enough at this mail public archive. Public archive administrator
should fix this against automated addresses collectors.
El 16/5/21 a les 0:42, Saint Michael ha escrit:
> --
> You received this message because you are subscribed to the Google
> Groups "lxc-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to lxc-users+...@lists.linuxcontainers.org
> <mailto:lxc-users+...@lists.linuxcontainers.org>.
> To view this discussion on the web visit
> https://groups.google.com/a/lists.linuxcontainers.org/d/msgid/lxc-users/CAC9cSOCy42P4PuehFuN_gkd7hX9D18ZvpMUQenvW%3DHPPu5Voig%40mail.gmail.com
> <https://groups.google.com/a/lists.linuxcontainers.org/d/msgid/lxc-users/CAC9cSOCy42P4PuehFuN_gkd7hX9D18ZvpMUQenvW%3DHPPu5Voig%40mail.gmail.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
0 new messages