Running Sage in Bash
I would like to execute a Sage file from my bash, similar to how I can run 'python Documents/test.py' and have Python execute the file. Is this possible? If so, how? I'm attempting to circumvent the interpreter and automate execution.
Find where Sage is installed, and do
/path/to/sage Documents/test.py
. Or add the directory containingsage
to your PATH, and then dosage Documents/test.py
, just like with Python.If you have a file with Sage commands, make sure you name the file with .sage suffix.
At least in Linux, I can do this:
Actually .py suffix should work too. I just notice this:
I am just learning sage, but there is yet another way to envoke sage that is even more bash-like. Assuming that sage is installed in "/usr/bin/sage" you can do:
@slcoleman: it's best if
sage
is in your PATH, and then the first line should be#!/usr/bin/env sage
.