1 | initial version |
As far as I know sage is not aware of piped inputs. It does have the -c
switch by which it can run commands "on-the-fly". You can use a while loop and collect all the code into a string and pass it on to sage. For this, you need to tell the while loop to stop collecting the code when some special string is present. Let us say the string is EOD
. Then the following is the basic syntax of the sage part of the pipelines:
# IFS='' is needed to preserve leading spaces
# -r is needed to read in raw mode, for example to preserve \ line continuation
while IFS='' read -r line; do
if [[ "${line}" = "EOD" ]]; then
sage -c "${thecode}"; thecode=""
else
thecode="${thecode}
${line}"
fi
done
Can not seem to answer this question in full! I will add the example in the comments.
2 | No.2 Revision |
As far as I know sage is not aware of piped inputs. It does have the -c
switch by which it can run commands "on-the-fly". You can use a while loop and collect all the code into a string and pass it on to sage. For this, you need to tell the while loop to stop collecting the code when some special string is present. Let us say the string is EOD
. Then the following is the basic syntax of the sage part of the pipelines:
# IFS='' is needed to preserve leading spaces
# -r is needed to read in raw mode, for example to preserve \ line continuation
while IFS='' read -r line; do
if [[ "${line}" = "EOD" ]]; then
sage -c "${thecode}"; thecode=""
else
thecode="${thecode}
${line}"
fi
done
Can not seem to answer this question in full! I will add It seems my shell code is creating issues with this website!! Anyway, here is the example in the comments.pastebin: http://pastebin.com/c3mb6USs
3 | No.3 Revision |
As far as I know sage is not aware of piped inputs. It does have the -c
switch by which it can run commands "on-the-fly". You can use a while loop and collect all the code into a string and pass it on to sage. For this, you need to tell the while loop to stop collecting the code when some special string is present. Let us say the string is EOD
. Then the following is the basic syntax of the sage part of the pipelines:
# IFS='' is needed to preserve leading spaces
# -r is needed to read in raw mode, for example to preserve \ line continuation
while IFS='' read -r line; do
if [[ "${line}" = "EOD" ]]; then
sage -c "${thecode}"; thecode=""
else
thecode="${thecode}
${line}"
fi
done
Can not seem to answer this question in full! It seems my shell code is creating issues with this website!! Anyway, here is the example in pastebin: http://pastebin.com/c3mb6USs
Notes:
myprogram1 | shell code |
myprogram2
then when any of the
there parts are running, then the
other parts will be idle.myprogram1 | sage_shell_code |
myprogram2
.4 | No.4 Revision |
As far as I know sage is not aware of piped inputs. It does have the -c
switch by which it can run commands "on-the-fly". You can use a while loop and collect all the code into a string and pass it on to sage. For this, you need to tell the while loop to stop collecting the code when some special string is present. Let us say the string is EOD
. Then the following is the basic syntax of the sage part of the pipelines:
# IFS='' is needed to preserve leading spaces
# -r is needed to read in raw mode, for example to preserve \ line continuation
while IFS='' read -r line; do
if [[ "${line}" = "EOD" ]]; then
sage -c "${thecode}"; thecode=""
else
thecode="${thecode}
${line}"
fi
done
Can not seem to answer this question in full! It seems my shell code is creating issues with this website!! Anyway, here is the example in pastebin: http://pastebin.com/c3mb6USs
Notes:
myprogram1 | shell code |
myprogram2
then when any of the
myprogram1 | sage_shell_code |
myprogram2
.5 | No.5 Revision |
As far as I know sage is not aware of piped inputs. It does have the -c
switch by which it can run commands "on-the-fly". You can use a while loop and collect all the code into a string and pass it on to sage. For this, you need to tell the while loop to stop collecting the code when some special string is present. Let us say the string is EOD
. Then the following is the basic syntax of the sage part of the pipelines:
# IFS='' is needed to preserve leading spaces
# -r is needed to read in raw mode, for example to preserve \ line continuation
while IFS='' read -r line; do
if [[ "${line}" = "EOD" ]]; then
sage -c "${thecode}"; thecode=""
else
thecode="${thecode}
${line}"
fi
done
Can not seem to answer this question in full! It seems my shell code is creating issues with this website!! Anyway, here is the example in pastebin: http://pastebin.com/c3mb6USs
Notes:
myprogram1 | shell code |
myprogram2
then when any of the
three parts are running, the
other parts might be idle. If the sage part is the slowest, which it could be because it is launching a new sage process every time, then this will myprogram1 | sage_shell_code |
myprogram2
.