all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / 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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.