all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Reading OS Version and decide what to do?
@ 2012-05-24 17:25 Daniel (Youngwhan)
  2012-05-24 18:44 ` Pascal J. Bourguignon
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel (Youngwhan) @ 2012-05-24 17:25 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I have no knowledge about Emacs LISP, but is there any way to get what
os version is being used?

For example, on linux and bash and external utility like cut, I can
get the os version by "uname -r" and get what I want by using cut
utility.

Is there a way to simulate like that in Emacs LISP? like launching
external process like "cut" or "uname -r" and get a string and if the
string matches what I want, do something and otherwise, do others?

Daniel


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Reading OS Version and decide what to do?
  2012-05-24 17:25 Reading OS Version and decide what to do? Daniel (Youngwhan)
@ 2012-05-24 18:44 ` Pascal J. Bourguignon
  0 siblings, 0 replies; 2+ messages in thread
From: Pascal J. Bourguignon @ 2012-05-24 18:44 UTC (permalink / raw)
  To: help-gnu-emacs

"Daniel (Youngwhan)" <breadncup@gmail.com> writes:

> Hi,
>
> I have no knowledge about Emacs LISP, but is there any way to get what
> os version is being used?
>
> For example, on linux and bash and external utility like cut, I can
> get the os version by "uname -r" and get what I want by using cut
> utility.
>
> Is there a way to simulate like that in Emacs LISP? like launching
> external process like "cut" or "uname -r" and get a string and if the
> string matches what I want, do something and otherwise, do others?


emacs has a few variables that let you know what environment it's
running in:


;; system-type          darwin   gnu/linux  cygwin
;; system-name          "naiad.informatimago.com" "hermes.afaa.asso.fr"
;; system-configuration "i686-pc-linux-gnu" "i686-pc-cygwin" "i386-apple-darwin9.8.0"
;; window-system        nil x mac ns w32
;; emacs-major-version  18 19 20 21 23
;; emacs-minor-version  0 1 2 3
;; emacs-version        "20.7.2" "21.2.1" 

Of course, you can also use

(shell-command-to-string "uname -a")
--> "Linux kuiper 2.6.38-gentoo-r6-pjb-c9 #2 SMP Wed Jul 13 00:23:08 CEST 2011 x86_64 Intel(R) Core(TM) i7 CPU 950 @ 3.07GHz GenuineIntel GNU/Linux
"

and parse it.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-05-24 18:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-24 17:25 Reading OS Version and decide what to do? Daniel (Youngwhan)
2012-05-24 18:44 ` Pascal J. Bourguignon

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.