On Friday, 27 May 2022 at 01:26:55 UTC+2 hohoa...@gmail.com wrote:

> Hi there,
>
> > Are you asking whether a shell script can handle complex arithmetic? 
> What does that have to do with Sage?
> Maybe it's just wishful thinking. One day, SageMath may have it's own 
> shell (smiley)
>
> A shell is a programming language, and sage has one: python. In fact, 
ipython (the interface used by sage) has some features to make it slightly 
more palatable as a CLI for operating system use:

https://ipython.org/ipython-doc/3/interactive/shell.html

However, on the side of "bash": semantically, commands like [...] are just 
process invocations. It's only for efficiency that they're implemented 
within the bash process itself.

You can already do:

$ sage -c "sys.exit( not(1==0))" || echo "false"
false
$ sage -c "sys.exit( not(1==1))" && echo "true"
true

so you can get sage results for logical flow control in bash already (note 
that in bash 0 means "true" and 1 means "false"; hence the confusing "not".

You can use this in bash "if" statements as well; look up the "test" 
spelling of "[ .. ]" (and there actually is a /usr/bin/test executable)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/99d4a6da-0725-4d72-aa72-eabf30b44d37n%40googlegroups.com.

Reply via email to