On Tue, Jan 13, 2009 at 7:15 AM, ben <[email protected]> wrote: > > Hello, > > I'm trying to communicate with sage using PHP. I want it to calculate > 1+2. I've written this little bash script: > > #!/bin/bash > cd /usr/local/sage-3.2.1 > ./sage -q << END > 1+2 > END > read -p "Press enter to continue" > > which outputs: > > sage: 3 > sage: > Exiting SAGE (CPU time 0m0.04s, Wall time 0m0.04s). > Press enter to continue > > however, when I execute the script from PHP using this: > > echo exec("cd /home/ben/Desktop && ./test.sh",$out); > print_r($out); > > it outputs: > > > ********************************************************************** > Welcome to IPython. I will try to create a personal configuration > directory where you can customize many aspects of IPython's > functionality in: /root/.sage/ipython Initializing from > configuration /usr/local/sage-3.2.1/local/lib/python2.5/site-packages/ > IPython/UserConfig Please press to start > IPython.********************************************************************** > Press enter to exit: > > why do I not get the same output as when I execute the script > directly? is there any way stopping the welcome message being output > every time? how can I get the answer 3?
For 1-liners use "sage -c": wst...@sage:~$ sage -c "print 1 + 2" 3 --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
