[Top][All Lists]

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

RE: shell command output question

From: Bingham, Jay
Subject: RE: shell command output question
Date: Thu, 25 Apr 2002 11:50:27 -0500

The following will work as long as there is only one new line in the string and 
it is at the end of the string:

(setq load-path (cons (split-string (shell-command-to-string
        "your_command") "\n") load-path)))

>From what you are trying to do I assume that "your command" will be something 
>like "echo $PATH".  You can access environment variables with the command 

So you could accomplish the same with:

(setq load-path (cons (getenv "PATH") load-path)))

.    COMPAQ NonStop Integrity Systems
.    Austin, TX
. Language is the apparel in which your thoughts parade in public.
. Never clothe them in vulgar and shoddy attire. -Dr. George W. Crane-

 -----Original Message-----
From:   Noel Yap [] 
Sent:   Wednesday, 24 April, 2002 9:50 p
To:     Niklas Morberg
Subject:        Re: shell command output question

--- Niklas Morberg <> wrote:
> Noel Yap <> writes:
> > I would like to have the following in my .emacs:
> >   (setq load-path (cons STUFF load-path))
> >
> > where STUFF is the output of a command line.  Does
> > anyone know how I would be able to do this?
> shell-command-to-string might be your friend. Does
> this work?
> (setq load-path (cons (shell-command-to-string
>                      "your_command") load-path))

It sort of does.  I just need to strip off the CR at
the end.  Would you happen to know how I can do that?


Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more

Help-gnu-emacs mailing list

reply via email to

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