Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support %%bash magic and ! syntax #66

Open
lukemarsden opened this issue Mar 8, 2022 · 0 comments
Open

Support %%bash magic and ! syntax #66

lukemarsden opened this issue Mar 8, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@lukemarsden
Copy link
Collaborator

lukemarsden commented Mar 8, 2022

You can sneak a bash script into a notebook with %%bash magic at the top of a cell or ! inline on individual lines.
Support these in SAME by porting them to subprocess calls or something.
Examples from a notebook I'm porting:

if os.path.isdir(export_path):
  print('\nAlready saved a model, cleaning up\n')
  !rm -r {export_path}
%%bash
DATAFILE="https://d17h27t6h515a5.cloudfront.net/topher/2017/February/5898cd6f_traffic-signs-data/traffic-signs-data.zip"
if [ -d "/tmp/traffic-signs-data" ]; then
    echo "Data already downloaded"
else
    echo "Downloading data from $DATAFILE"
    mkdir /tmp/traffic-signs-data
    curl -s -o /tmp/traffic-signs-data/traffic-signs-data.zip $DATAFILE
    (cd /tmp/traffic-signs-data && unzip traffic-signs-data.zip && rm -f traffic-signs-data.zip)
    (mv /tmp/traffic-signs-data/* .)
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants