From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Pascal J. Bourguignon" Newsgroups: gmane.emacs.help Subject: Re: Reading OS Version and decide what to do? Date: Thu, 24 May 2012 20:44:09 +0200 Organization: Informatimago Message-ID: <87wr41zafa.fsf@kuiper.lan.informatimago.com> References: <32b2aaad-e3e1-42fe-a4e2-8316536c1fde@f9g2000pbd.googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1337885118 16229 80.91.229.3 (24 May 2012 18:45:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 24 May 2012 18:45:18 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu May 24 20:45:17 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SXd29-0007To-QV for geh-help-gnu-emacs@m.gmane.org; Thu, 24 May 2012 20:45:13 +0200 Original-Received: from localhost ([::1]:58692 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXd29-0003Yr-Ep for geh-help-gnu-emacs@m.gmane.org; Thu, 24 May 2012 14:45:13 -0400 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 39 Original-X-Trace: individual.net 7YLfFB4ncxXEAlH9Sx9F6QIf+npWjD1TjMxsYoIjw+RMW2ZPI7JbvZLKKQ1vSlBgmS Cancel-Lock: sha1:YzRmZjhhNWE1YWQ4OGRiNGRiMzQzODg0OGE2MmQ4NWVlYmQyNThlNA== sha1:meKpc8fMrL4PgZME6Dj6Xs7vQWI= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:192552 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:84957 Archived-At: "Daniel (Youngwhan)" 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 {}.