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

[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 
>getenv

So you could accomplish the same with:

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


J_)
C_)ingham
.    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 [mailto:address@hidden 
Sent:   Wednesday, 24 April, 2002 9:50 p
To:     Niklas Morberg
Cc:     address@hidden
Subject:        Re: shell command output question

--- Niklas Morberg <address@hidden> wrote:
> Noel Yap <address@hidden> 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?

Thanks,
Noel


__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/

_______________________________________________
Help-gnu-emacs mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/help-gnu-emacs




reply via email to

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