Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Calling Unix shell command as an expression

Can I call a Unix shell command from within Sage as an expression? For example, I might want to do something like

process_local_directory_for_something(!pwd)

Unfortunately, the !-operator does _very_ weird things when used as an expression (bug?), so the above doesn't work. The os.system() does not work either (it returns the return code instead of the output). Of course, Python has options, like handling pipes or subprocesses, but for many applications this is a bit tedious.