unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Holger Sparr <sparr+usenet@mfk.mw.tu-dresden.de>
Subject: Re: Interactive string input and comparison
Date: Fri, 30 Jun 2006 09:58:29 +0200	[thread overview]
Message-ID: <lnwtaz6pne.fsf@mfk.mw.tu-dresden.de> (raw)
In-Reply-To: 1151611136.194537.176220@y41g2000cwy.googlegroups.com

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

-- 

      reply	other threads:[~2006-06-30  7:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-29 19:58 Interactive string input and comparison scm
2006-06-30  7:58 ` Holger Sparr [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=lnwtaz6pne.fsf@mfk.mw.tu-dresden.de \
    --to=sparr+usenet@mfk.mw.tu-dresden.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).