[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [OT] Babel user queries like SH "read CONFIRM"
From: |
Eric Schulte |
Subject: |
Re: [O] [OT] Babel user queries like SH "read CONFIRM" |
Date: |
Wed, 08 Feb 2012 09:46:26 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) |
brian powell <address@hidden> 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/