all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Bingham, Jay" <Jay.Bingham@compaq.com>
Subject: RE: shell command output question
Date: Thu, 25 Apr 2002 11:50:27 -0500	[thread overview]
Message-ID: <72A87F7160C0994D8C5A36E2FDC227F501CE2B26@txnexc01.americas.cpqcorp.net> (raw)

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:yap_noel@yahoo.com] 
Sent:	Wednesday, 24 April, 2002 9:50 p
To:	Niklas Morberg
Cc:	help-gnu-emacs@gnu.org
Subject:	Re: shell command output question

--- Niklas Morberg <niklas.morberg@axis.com> wrote:
> Noel Yap <yap_noel@yahoo.com> 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
Help-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnu-emacs

             reply	other threads:[~2002-04-25 16:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-25 16:50 Bingham, Jay [this message]
2002-04-26 15:58 ` shell command output question G Anna
2002-04-26 19:26   ` Noel Yap
2002-04-27  6:39     ` G Anna
  -- strict thread matches above, loose matches on Subject: below --
2002-04-23 20:30 Noel Yap
2002-04-24  5:13 ` Kalyan K. Mukherjea
2002-04-24 11:09   ` Noel Yap
2002-04-24 13:15 ` Niklas Morberg
2002-04-25  2:50   ` Noel Yap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=72A87F7160C0994D8C5A36E2FDC227F501CE2B26@txnexc01.americas.cpqcorp.net \
    --to=jay.bingham@compaq.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.