From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: [OT] Babel user queries like SH "read CONFIRM" Date: Wed, 08 Feb 2012 09:46:26 -0700 Message-ID: <87wr7xmfx9.fsf@gmx.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:54656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvAfg-0007ij-DZ for emacs-orgmode@gnu.org; Wed, 08 Feb 2012 11:47:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RvAfX-00087b-RX for emacs-orgmode@gnu.org; Wed, 08 Feb 2012 11:47:04 -0500 Received: from mailout-us.gmx.com ([74.208.5.67]:47426 helo=mailout-us.mail.com) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1RvAfX-00087R-He for emacs-orgmode@gnu.org; Wed, 08 Feb 2012 11:46:55 -0500 In-Reply-To: (brian powell's message of "Wed, 8 Feb 2012 11:20:43 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: brian powell Cc: emacs-orgmode@gnu.org brian powell 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/