unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Interactive string input and comparison
@ 2006-06-29 19:58 scm
  2006-06-30  7:58 ` Holger Sparr
  0 siblings, 1 reply; 2+ messages in thread
From: scm @ 2006-06-29 19:58 UTC (permalink / raw)


Greetings,

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)

Thanks in advance to anyone who can take the time to answer this
question.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Interactive string input and comparison
  2006-06-29 19:58 Interactive string input and comparison scm
@ 2006-06-30  7:58 ` Holger Sparr
  0 siblings, 0 replies; 2+ messages in thread
From: Holger Sparr @ 2006-06-30  7:58 UTC (permalink / raw)


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

-- 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-06-30  7:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-29 19:58 Interactive string input and comparison scm
2006-06-30  7:58 ` Holger Sparr

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).