help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Examining the output of a shell command?


From: Barry Margolin
Subject: Re: Examining the output of a shell command?
Date: Sun, 28 Jun 2015 21:39:09 -0400
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <mmpa5e$ma0$1@dont-email.me>, Dan Espen <despen@verizon.net> 
wrote:

> Michael Heerdegen <michael_heerdegen@web.de> writes:
> 
> > Dan Espen <despen@verizon.net> writes:
> >
> >> Maybe the OP doesn't realize that some programs that output
> >> escape sequences won't do so when run as an Emacs shell command.
> >>
> >> /bin/ls being a good example.
> >>
> >> In that case, run:
> >>
> >> /bin/ls --color
> >>
> >> as an Emacs shell command.
> >
> > I guess programs like "ls" check the TERM environment variable.
> >
> > Try:
> >
> > (setenv "TERM" "xterm")
> 
> I doubt $TERM is the key.
> /bin/ls knows when it is interactive.

What they often check is whether stdout is connected to a terminal.

> > (shell-command-to-string "ls --color")
> 
> This will show escape sequences regardless of $TERM.
> It did for me with the Emacs default value "dumb".

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


reply via email to

[Prev in Thread] Current Thread [Next in Thread]