Re: [O] [OT] Babel user queries like SH "read CONFIRM"

2012-02-08 Thread Eric Schulte
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/



[O] [OT] Babel user queries like SH "read CONFIRM"

2012-02-08 Thread brian powell
* 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