5
$\begingroup$

I would like to automate the commands in this website into a batch file, so when the batch file it runs these commands in sequence. http://community.wolfram.com/groups/-/m/t/157461

Do any of you have any ideas. I know that you can just type in wolfram in a batch file like this:

#!/bin/bash
wolfram

It will give you this output:

Wolfram Language (Raspberry Pi Pilot Release)
Copyright 1988-2013 Wolfram Research
Information & help: wolfram.com/raspi

In[1]:=

How would you enter commands in the In[1]:= from a batch script?

Thanks in advance. Ahmad

EDIT I think this could help from http://reference.wolfram.com/language/guide/RaspberryPi.html

wolfram -script file.wl 
$\endgroup$
8
  • $\begingroup$ reference.wolfram.com/mathematica/tutorial/… I've always used .m extension for mathematica scripts, .wl is new to me. $\endgroup$
    – shrx
    Commented Dec 28, 2013 at 19:51
  • $\begingroup$ nice, i'll try it out now $\endgroup$
    – Hamoudy
    Commented Dec 28, 2013 at 19:55
  • $\begingroup$ Have you tried this wolfram -script file.wl line that you suggest yourself? $\endgroup$ Commented Dec 28, 2013 at 19:55
  • $\begingroup$ @shrx This is for the new version of Mathematica on the Raspberry Pi where many things with Mathematica-related names are renamed to match the new Wolfram Language name. $\endgroup$ Commented Dec 28, 2013 at 19:57
  • $\begingroup$ Yes, I'm not sure how to format commands in the file, e.g. if I wanted 1+1, what would I do. I have tried just putting 1+1 and saving the file as test.wl, but nothing is output in the command window. BTW, this is for the PI. $\endgroup$
    – Hamoudy
    Commented Dec 28, 2013 at 19:59

1 Answer 1

8
$\begingroup$

Here is a minimal example on how to run a mathematica script on a raspberry pi. Create a simple script (I used my bash terminal to do it):

echo "sum=1+1; Print[sum]" > test.wl

Excecute the script:

wolfram -script test.wl

2

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.