[lxc-devel] [lxd/master] Added documentation about shell env to lxc exec

cebe on Github lxc-bot at linuxcontainers.org
Thu Nov 30 10:23:04 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 470 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20171130/c2932790/attachment.bin>
-------------- next part --------------
From 3d96cbcebcb24c92df87147e173f423488b34712 Mon Sep 17 00:00:00 2001
From: Carsten Brandt <mail at cebe.cc>
Date: Thu, 30 Nov 2017 11:21:01 +0100
Subject: [PATCH] Added documentation about shell env to lxc exec

See https://github.com/lxc/lxd/issues/3054#issuecomment-347925994
---
 lxc/exec.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lxc/exec.go b/lxc/exec.go
index 5422b9056..b0865444b 100644
--- a/lxc/exec.go
+++ b/lxc/exec.go
@@ -55,6 +55,12 @@ func (c *execCmd) usage() string {
 
 Execute commands in containers.
 
+The command is executed directly using exec, so there is no shell and shell patterns (variables, file redirects, ...)
+won't be understood. If you need a shell environment you need to execute the shell executeable, passing the shell commands
+as arguments, for example:
+
+    lxc exec <container> -- sh -c "cd /tmp && pwd"
+
 Mode defaults to non-interactive, interactive mode is selected if both stdin AND stdout are terminals (stderr is ignored).`)
 }
 


More information about the lxc-devel mailing list