Re: environment variables

"David T. Pierson" <dtp-tWP3OOf8k3DqlBn2x/[email protected]>
Newsgroups gmane.comp.gnu.screen.user
Message-ID <1386393765.16547%[email protected]>
On Thu, Dec 05, 2013 at 10:08:36PM +0100, Nico Schlömer wrote:
> I get
> 
> $ screen
> --> screen
> $ echo $FOO
> bar
> 
> but a detached shell yields nothing:
> 
> $ screen -s /bin/bash -L -d -m echo $FOO
> $

There are a couple of things to say here.

The lack of output has nothing to do with the environment variable.  The
echo command is running within the new screen session, to which you are
not attaching (and which will exit after echo exits.)  So nothing should
appear as output in the current shell.  Try:

  $ screen -d -m echo foo

to see the same thing (nothing) in your current shell.

However, since you used -L to enable logging, you should see the output
in the log.

Finally, note that $FOO gets expanded by the current shell before screen
is invoked.  If you want different behavior, please be more specific
about what you are really trying to accomplish.

David
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.