[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Reading OS Version and decide what to do?
From: |
Pascal J. Bourguignon |
Subject: |
Re: Reading OS Version and decide what to do? |
Date: |
Thu, 24 May 2012 20:44:09 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) |
"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 {}.