Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Reading OS Version and decide what to do?

6 views
Skip to first unread message

Daniel (Youngwhan)

unread,
May 24, 2012, 1:25:29 PM5/24/12
to
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

Pascal J. Bourguignon

unread,
May 24, 2012, 2:44:09 PM5/24/12
to
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 {}.
0 new messages