[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Interactive string input and comparison
From: |
Holger Sparr |
Subject: |
Re: Interactive string input and comparison |
Date: |
Fri, 30 Jun 2006 09:58:29 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
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
--