From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Holger Sparr Newsgroups: gmane.emacs.help Subject: Re: Interactive string input and comparison Date: Fri, 30 Jun 2006 09:58:29 +0200 Organization: Technische Universitaet Dresden, Germany Message-ID: References: <1151611136.194537.176220@y41g2000cwy.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1151656892 30404 80.91.229.2 (30 Jun 2006 08:41:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 30 Jun 2006 08:41:32 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jun 30 10:41:27 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FwEZ2-0007Ds-D9 for geh-help-gnu-emacs@m.gmane.org; Fri, 30 Jun 2006 10:41:25 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FwEZ1-0001ew-OC for geh-help-gnu-emacs@m.gmane.org; Fri, 30 Jun 2006 04:41:23 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!news.dfncis.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 25 Original-X-Trace: news.dfncis.de P7RRm9IC58/Q4b1q+2xVmA7HyEBffyhCIhdMoyIV8DRalu Mail-Copies-To: never User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:6L6HOy000WaSVV25IDku13LM0qI= Original-Xref: shelby.stanford.edu gnu.emacs.help:140126 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:35751 Archived-At: On 29 Jun 2006, scm wrote: > I am trying to write an interactive Elisp program that will take the > input of a string, and depending what the string is, run a shell > command. I also what to have an error printed if the given shell > command does not exist. This is my attempt at the code so far: > > (defun ls () > (interactive) > (prompt for input? variable?) > (if (string-match "ls" ) > (shell-command "ls -l) (defun test-ls (cmd) (interactive "sString: ") (if (string-match "ls" cmd) (shell-command "ls -l") (message "Command %s does not exist." cmd))) see "C-h f interactive RET" Holger --