︠20c4e835-34e7-41cd-9546-ef87f3a1f3e8i︠ %md # bash jupyter kernel in sage worksheet Features shown: - remember variables and working directory between cells - ansi colors displayed in output - display images by sending file to stdin for `display` command - autocompletion ︡aee9daab-b146-42a0-9df9-caf9cac290e9︡{"done":true,"md":"\n# bash jupyter kernel in sage worksheet\n\nFeatures shown:\n\n- remember variables and working directory between cells\n- ansi colors displayed in output\n- display images by sending file to stdin for `display` command\n- autocompletion"} ︠d48a0c6a-b2d1-4bb5-849e-c784e1d0fcd0s︠ %auto jbash = jupyter("bash") %default_mode jbash ︡b92fe98a-1163-4ce0-81c6-1f3f1426c119︡{"html":"\n\n\n\n\n\n\n\n
\n\n
\n\n\n\n"}︡{"done":true}︡ ︠2eb29126-fdb1-454f-b673-37e98e89d86ds︠ set | grep SHELL ︡364645d0-ec30-4eaf-ba8a-f37827fb2e5c︡{"html":"
SHELL=/bin/bash\r\nSHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor\r\n
"}︡{"done":true}︡ ︠6c0c9e82-eb97-4336-820b-ba1b44aa3107s︠ pwd echo ls ︡2bc2a825-ed07-4a44-b600-d3fbaeaaed1e︡{"html":"
/projects/ccd4d4a4-29a8-4c39-85c2-a630cb1e9b6c/cloud-examples/sagews-jupyter\r\n\r\nbash.sagews  jupyter-python3.sagews  r-completion.png  r.sagews  sage.png\r\n
"}︡{"done":true}︡ ︠cb6d1562-b58c-4f48-a880-5937e99a7af5s︠ # display an image display < sage.png ︡31ccebff-82ae-4c9a-8e9c-7840dcbcdc67︡{"html":"
"}︡{"file":{"filename":"/tmp/tmplza5A2.png","show":true,"text":null,"uuid":"324ffe38-40cc-4b0a-bb66-949d88b43bbf"},"once":false}︡{"done":true}︡
︠77b47e2b-58af-4095-8b57-0858baa1716ds︠
# set variables and working directory in a cell
VAR1='hello'
VAR2='world'
cd ..
︡a16e3759-ab8f-45b8-b34c-ccf05e84b281︡{"html":"
"}︡{"done":true}︡
︠5eed1562-ece9-4952-af37-bf124f9c0720s︠
# verify variables and working directory in next cell
pwd
echo
echo $VAR1 $VAR2
︡ddde5e57-eb33-4338-87d5-94677d1cb0f9︡{"html":"
/projects/ccd4d4a4-29a8-4c39-85c2-a630cb1e9b6c/cloud-examples\r\n\r\nhello world\r\n
"}︡{"done":true}︡ ︠a5a54e52-51c3-4b7d-90f6-44943cd738f6s︠ # autocompletion # put cursor at the end of VAR and type TAB echo $VAR ︡7aa71a20-a328-4687-af20-603dcd87f5a2︡{"html":"
\r\n
"}︡{"done":true}︡ ︠8dda1a24-2e64-4c3a-bf2e-3fcb622fc501︠