* [OT] Babel user queries like SH "read CONFIRM"
@ 2012-02-08 16:20 brian powell
2012-02-08 16:46 ` Eric Schulte
0 siblings, 1 reply; 2+ messages in thread
From: brian powell @ 2012-02-08 16:20 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 471 bytes --]
* 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
[-- Attachment #2: Type: text/html, Size: 967 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [OT] Babel user queries like SH "read CONFIRM"
2012-02-08 16:20 [OT] Babel user queries like SH "read CONFIRM" brian powell
@ 2012-02-08 16:46 ` Eric Schulte
0 siblings, 0 replies; 2+ messages in thread
From: Eric Schulte @ 2012-02-08 16:46 UTC (permalink / raw)
To: brian powell; +Cc: emacs-orgmode
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/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-02-08 16:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-08 16:20 [OT] Babel user queries like SH "read CONFIRM" brian powell
2012-02-08 16:46 ` Eric Schulte
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.