emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <eric.schulte@gmx.com>
To: brian powell <briangpowellms@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [OT] Babel user queries like SH "read CONFIRM"
Date: Wed, 08 Feb 2012 09:46:26 -0700	[thread overview]
Message-ID: <87wr7xmfx9.fsf@gmx.com> (raw)
In-Reply-To: <CAFm0skFg32rwou7T+gEje2enj0qmHXEP0crgF2w_v8cVWGZ-xw@mail.gmail.com> (brian powell's message of "Wed, 8 Feb 2012 11:20:43 -0500")

brian powell <briangpowellms@gmail.com> writes:

> * Is there a simple way in BABEL to interact/query a user--something like
> this won't work:
>
> #+begin_src sh
> cat blah-install.sh
> echo -n " Sure you want to run this install script code to install
> BlahSoftware? (y/n): "
> read CONFIRM
>   case $CONFIRM in
>     y|Y) sh blah-software-install.sh;;
>     n|N)
>       echo "
> ERROR 5: User declined the agreement.
> "
>       exit
>       ;;
>     *) echo "
> That is not vaild input and/or user declined to run install script.
> "
>   esac
> #+end_src

Fun question, the following should work.

#+begin_src sh :eval (if (y-or-n-p "Install this software?") "yes" "no")
  echo "Going ahead with operation"
#+end_src

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

      reply	other threads:[~2012-02-08 16:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-08 16:20 [OT] Babel user queries like SH "read CONFIRM" brian powell
2012-02-08 16:46 ` Eric Schulte [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.orgmode.org/

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

  git send-email \
    --in-reply-to=87wr7xmfx9.fsf@gmx.com \
    --to=eric.schulte@gmx.com \
    --cc=briangpowellms@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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.
Code repositories for project(s) associated with this public inbox

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

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